effect-ts-laws
Version:
effect-ts law testing using fast-check.
24 lines • 921 B
JavaScript
import { LawSet } from '#law';
/**
* Define a set of laws for some typeclass on a concrete type.
* @param typeclassName - Used as label for test `description()` block.
* @param laws - list of `Law` to test.
* @returns A set of laws ready to be tested.
* @category harness
*/
export const defineConcreteLaws = (typeclassName, ...laws) => (
/**
* Optional suffix to attach to `LawTest` label. Used, for example,
* to differentiate between the different `Monoid` instances of
* `Boolean`.
*/
suffix = '',
/**
* Optional list of `LawSet`s that are required for the
* typeclass under test. For example, the `Monoid` laws
* require the instance under test pass the `Semigroup`
* laws besides the `Monoid` laws themselves. They do
* this by adding the `Semigroup` laws in this field.
*/
...sets) => LawSet(...sets)(typeclassName + (suffix === '' ? '' : `.${suffix}`), ...laws);
//# sourceMappingURL=given.js.map