Skip to main content

Interface: Property<Ts>

Defined in: packages/fast-check/src/check/property/types/Property.ts:17

Interface for a Property

A property is the combination of:

  • Arbitraries: how to generate the inputs for the algorithm
  • Predicate: how to confirm the algorithm succeeded?

Remarks​

Since 5.0.0 (previously called IAsyncProperty in 1.19.0)

Type Parameters​

Type Parameter
Ts

Methods​

generate()​

generate(mrng, runId?): Value<Ts>

Defined in: packages/fast-check/src/check/property/types/Property.ts:26

Generate values of type Ts

Parameters​

ParameterTypeDescription
mrngRandomRandom number generator
runId?numberId of the generation, starting at 0 - if set the generation might be biased

Returns​

Value<Ts>

Remarks​

Since 0.0.6 (return type changed in 3.0.0)


run()​

run(v, executionContext): PropertyFailure | PreconditionFailure | Promise<PropertyFailure | PreconditionFailure | null> | null

Defined in: packages/fast-check/src/check/property/types/Property.ts:43

Check the predicate for v

Parameters​

ParameterTypeDescription
vTsValue of which we want to check the predicate
executionContextPredicateExecutionContextContext passed to the predicate

Returns​

PropertyFailure | PreconditionFailure | Promise<PropertyFailure | PreconditionFailure | null> | null

Remarks​

Since 0.0.1 (signature changed in 0.0.6; asynchronous support since 0.0.7; execution context since 5.0.0)


shrink()​

shrink(value): IteratorObject<Value<Ts>>

Defined in: packages/fast-check/src/check/property/types/Property.ts:35

Shrink value of type Ts

Parameters​

ParameterTypeDescription
valueValue<Ts>The value to be shrunk, it can be context-less

Returns​

IteratorObject<Value<Ts>>

Remarks​

Since 3.0.0 (return type changed in 5.0.0)