UNPKG

@fast-check/jest

Version:

Property based testing for Jest based on fast-check

15 lines (14 loc) 848 B
import type { Parameters as FcParameters } from 'fast-check'; import type { ArbitraryTuple, Prop, ArbitraryRecord, PropRecord, JestExtra, FcExtra } from './types.js'; /** * Revamped {it,test} with added `.prop` */ export type FastCheckItBuilder<T> = T & ('each' extends keyof T ? T & { prop: <Ts, TsParameters extends Ts = Ts>(arbitraries: Ts extends [any] | any[] ? ArbitraryTuple<Ts> : ArbitraryRecord<Ts>, params?: FcParameters<TsParameters>) => (testName: string, prop: Ts extends [any] | any[] ? Prop<Ts> : PropRecord<Ts>, timeout?: number) => void; } : T) & { [K in keyof Omit<T, 'each'>]: FastCheckItBuilder<T[K]>; }; /** * Build the enriched version of {it,test}, the one with added `.prop` */ export declare function buildTest<T extends (...args: any[]) => any>(testFn: T, jest: JestExtra, fc: FcExtra): FastCheckItBuilder<T>;