From 8a6cfd0187b149a1ce83f62af62bb227ee441277 Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Tue, 2 Dec 2025 04:24:15 +0100 Subject: Make property async aware --- pbt/ts/src/property.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'pbt/ts/src/property.test.ts') 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 = ([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), -- cgit v1.3.1