Interface: FunctorLawConfig<F, A>
Defined in: testing/laws/types.ts:20
Configuration for testing functor laws.
Example
testFunctorLaws({
type: 'Result',
of: ok,
map: Result.map,
testCases: [
{ value: 5, transforms: [x => x * 2, x => x + 1] }
]
})
Type Parameters
F
F
A
A
Properties
equals()?
optionalequals: (a,b) =>boolean
Defined in: testing/laws/types.ts:44
Custom equality function for comparing functor values. Defaults to deep equality check.
Parameters
a
F
b
F
Returns
boolean
map()
map: <
B>(fa,fn) =>F
Defined in: testing/laws/types.ts:38
Map function to test.
Type Parameters
B
B
Parameters
fa
F
fn
(a) => B
Returns
F
Example
Result.map, Option.map
of()
of: (
value) =>F
Defined in: testing/laws/types.ts:31
Constructor function to wrap values in the functor.
Parameters
value
A
Returns
F
Example
ok, some, Just
testCases?
optionaltestCases:FunctorTestCase<A>[]
Defined in: testing/laws/types.ts:50
Specific test cases to run. If not provided, uses default test cases.
type
type:
string
Defined in: testing/laws/types.ts:24
Name of the type being tested (for test descriptions).