-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPredicate.spec.ts
34 lines (31 loc) · 993 Bytes
/
Predicate.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/** Typeclass law tests for the `Predicate` datatype. */
import {
Contravariant,
getMonoidEqv,
getMonoidEvery,
getMonoidSome,
getMonoidXor,
} from '@effect/typeclass/data/Predicate'
import {Boolean as BO, pipe} from 'effect'
import {getMonoUnaryEquivalence, Mono, predicate} from 'effect-ts-laws'
import {testMonoids, testTypeclassLaws} from 'effect-ts-laws/vitest'
import {PredicateTypeLambda} from 'effect/Predicate'
const Arbitrary = predicate<Mono>()
const Equivalence = getMonoUnaryEquivalence(BO.Equivalence)
describe('@effect/typeclass/data/Predicate', () => {
testTypeclassLaws.contravariant<PredicateTypeLambda>({
Arbitrary,
Equivalence,
})({Contravariant}, {numRuns: 100})
describe('Semigroup/monoid', () => {
pipe(
{
eqv: getMonoidEqv<Mono>(),
some: getMonoidSome<Mono>(),
xor: getMonoidXor<Mono>(),
every: getMonoidEvery<Mono>(),
},
testMonoids(Arbitrary, Equivalence, {numRuns: 100}),
)
})
})