MCPcopy
hub / github.com/Effect-TS/effect / assertExtend

Function assertExtend

packages/effect/test/Schema/Schema/extend.test.ts:9–31  ·  view source on GitHub ↗
(A: Schema.Schema.Any, B: Schema.Schema.Any, expected: readonly [string, string], options?: {
  readonly skipFastCheck?: boolean | undefined
})

Source from the content-addressed store, hash-verified

7import * as Util from "../TestUtils.js"
8
9const assertExtend = (A: Schema.Schema.Any, B: Schema.Schema.Any, expected: readonly [string, string], options?: {
10 readonly skipFastCheck?: boolean | undefined
11}) => {
12 const AB = Schema.extend(A, B)
13 const BA = Schema.extend(B, A)
14 strictEqual(String(AB), expected[0], "AB")
15 strictEqual(String(BA), expected[1], "BA")
16 const arbAB = Arbitrary.make(AB)
17 const arbBA = Arbitrary.make(BA)
18 const isAB = Schema.is(AB)
19 const isBA = Schema.is(BA)
20 if (options?.skipFastCheck) {
21 return
22 }
23 FastCheck.assert(
24 FastCheck.property(arbAB, (ab) => isBA(ab)),
25 { numRuns: 10 }
26 )
27 FastCheck.assert(
28 FastCheck.property(arbBA, (ba) => isAB(ba)),
29 { numRuns: 10 }
30 )
31}
32
33describe("extend", () => {
34 describe("String", () => {

Callers 1

extend.test.tsFile · 0.85

Calls 5

strictEqualFunction · 0.90
StringInterface · 0.85
makeMethod · 0.65
isMethod · 0.65
assertMethod · 0.65

Tested by

no test coverage detected