summaryrefslogtreecommitdiff
path: root/pbt/ts/src/property.test.ts
diff options
context:
space:
mode:
authorArnaud Bailly <arnaud@pankzsoft.com>2025-12-02 04:24:15 +0100
committerArnaud Bailly <arnaud@pankzsoft.com>2025-12-02 04:24:15 +0100
commit8a6cfd0187b149a1ce83f62af62bb227ee441277 (patch)
tree504ac7f631a93cf813fb1a86afd4b9ee23d23d60 /pbt/ts/src/property.test.ts
parent03d9f62f99afbae961fbf5846f015be5f6eee2b1 (diff)
downloadlambda-nantes-8a6cfd0187b149a1ce83f62af62bb227ee441277.tar.gz
Make property async aware
Diffstat (limited to 'pbt/ts/src/property.test.ts')
-rw-r--r--pbt/ts/src/property.test.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/pbt/ts/src/property.test.ts b/pbt/ts/src/property.test.ts
index 920457a..addff34 100644
--- a/pbt/ts/src/property.test.ts
+++ b/pbt/ts/src/property.test.ts
@@ -7,18 +7,18 @@ import {
} from './property';
// from https://github.com/jlink/shrinking-challenge/blob/main/challenges/difference.md
-const predicate1: (pair: [number, number]) => boolean = ([x, y]) =>
- x < 10 || x !== y;
+const predicate1: (pair: [number, number]) => Promise<boolean> = ([x, y]) =>
+ Promise.resolve(x < 10 || x !== y);
describe('Find minimal counterexample', () => {
- test('do not shrink example if no shrinker given', () => {
- const result = property(pairOf(positiveInt), predicate1)(42, 1);
+ test('do not shrink example if no shrinker given', async () => {
+ const result = await property(pairOf(positiveInt), predicate1)(42, 1);
expect(result.result).toBe('Falsified');
expect(result.counterexample).toBeNull;
});
- test('shrink example if shrinker given', () => {
- const result = property(
+ test('shrink example if shrinker given', async () => {
+ const result = await property(
pairOf(positiveInt),
predicate1,
shrinkPair(shrinkPositive, shrinkPositive),