Tuple whose elements are the predicate arguments.
Arbitrary for the arguments tuple of the predicate.
Law name to be used as test name. You can include a description of the
unit under test or anything else you wish to appear in the test name,
for example: MyList.map:associative
.
A note shown only on failure or in verbose mode.
Optional
parametersfast-check
configuration
parameters.
Predicate to be tested. Its arguments will appear in a single tuple.
A paper-thin wrapper over a fast-check property and its runtime configuration adding:
Law ≡ property + assert + test
- Testing a law will run the fast-check property inside an assertion inside a vitesttest(() => {...})
block. This means you can call testLaw and/or testLaws from inside adescribe(() => {...})
block, or even from the top level of your test file, but not inside atest(() => {...})
block.checkLaw
. This exactly the same astestLaw
, except in a pure function that returns the test results without using anyvitest
blocks.Law
s can be grouped under a single label intoLawSet
. Useful for testing units that require multiple laws, for example typeclasses. Besides its child laws, aLawSet
can includes otherLawSets
as requirements to be run as a guard before testing its own laws.fc.Property
it is wrapping, but also a field for a note. It is shown only on failure or when thefast-check
runtime parameterverbose
is true. A law can be converted into afast-check
property and tested.