bupkis 0.18.1 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -4
- package/src/assertion/assertion-types.ts +4 -4
- package/src/assertion/impl/sync-parametric.ts +1 -1
- package/src/expect.ts +0 -4
- package/src/guards.ts +24 -24
- package/src/internal-schema.ts +16 -32
- package/src/value-to-schema.ts +1 -1
- package/dist/assertion/assertion-async.cjs +0 -268
- package/dist/assertion/assertion-async.cjs.map +0 -1
- package/dist/assertion/assertion-async.d.cts +0 -40
- package/dist/assertion/assertion-async.d.cts.map +0 -1
- package/dist/assertion/assertion-async.d.ts +0 -40
- package/dist/assertion/assertion-async.d.ts.map +0 -1
- package/dist/assertion/assertion-async.js +0 -259
- package/dist/assertion/assertion-async.js.map +0 -1
- package/dist/assertion/assertion-standard-schema-async.cjs +0 -132
- package/dist/assertion/assertion-standard-schema-async.cjs.map +0 -1
- package/dist/assertion/assertion-standard-schema-async.d.cts +0 -52
- package/dist/assertion/assertion-standard-schema-async.d.cts.map +0 -1
- package/dist/assertion/assertion-standard-schema-async.d.ts +0 -52
- package/dist/assertion/assertion-standard-schema-async.d.ts.map +0 -1
- package/dist/assertion/assertion-standard-schema-async.js +0 -128
- package/dist/assertion/assertion-standard-schema-async.js.map +0 -1
- package/dist/assertion/assertion-standard-schema-sync.cjs +0 -141
- package/dist/assertion/assertion-standard-schema-sync.cjs.map +0 -1
- package/dist/assertion/assertion-standard-schema-sync.d.cts +0 -52
- package/dist/assertion/assertion-standard-schema-sync.d.cts.map +0 -1
- package/dist/assertion/assertion-standard-schema-sync.d.ts +0 -52
- package/dist/assertion/assertion-standard-schema-sync.d.ts.map +0 -1
- package/dist/assertion/assertion-standard-schema-sync.js +0 -137
- package/dist/assertion/assertion-standard-schema-sync.js.map +0 -1
- package/dist/assertion/assertion-sync.cjs +0 -284
- package/dist/assertion/assertion-sync.cjs.map +0 -1
- package/dist/assertion/assertion-sync.d.cts +0 -60
- package/dist/assertion/assertion-sync.d.cts.map +0 -1
- package/dist/assertion/assertion-sync.d.ts +0 -60
- package/dist/assertion/assertion-sync.d.ts.map +0 -1
- package/dist/assertion/assertion-sync.js +0 -275
- package/dist/assertion/assertion-sync.js.map +0 -1
- package/dist/assertion/assertion-types.cjs +0 -20
- package/dist/assertion/assertion-types.cjs.map +0 -1
- package/dist/assertion/assertion-types.d.cts +0 -1086
- package/dist/assertion/assertion-types.d.cts.map +0 -1
- package/dist/assertion/assertion-types.d.ts +0 -1086
- package/dist/assertion/assertion-types.d.ts.map +0 -1
- package/dist/assertion/assertion-types.js +0 -19
- package/dist/assertion/assertion-types.js.map +0 -1
- package/dist/assertion/assertion.cjs +0 -382
- package/dist/assertion/assertion.cjs.map +0 -1
- package/dist/assertion/assertion.d.cts +0 -109
- package/dist/assertion/assertion.d.cts.map +0 -1
- package/dist/assertion/assertion.d.ts +0 -109
- package/dist/assertion/assertion.d.ts.map +0 -1
- package/dist/assertion/assertion.js +0 -375
- package/dist/assertion/assertion.js.map +0 -1
- package/dist/assertion/create.cjs +0 -148
- package/dist/assertion/create.cjs.map +0 -1
- package/dist/assertion/create.d.cts +0 -85
- package/dist/assertion/create.d.cts.map +0 -1
- package/dist/assertion/create.d.ts +0 -85
- package/dist/assertion/create.d.ts.map +0 -1
- package/dist/assertion/create.js +0 -143
- package/dist/assertion/create.js.map +0 -1
- package/dist/assertion/format-assertion-failure.cjs +0 -63
- package/dist/assertion/format-assertion-failure.cjs.map +0 -1
- package/dist/assertion/format-assertion-failure.d.cts +0 -21
- package/dist/assertion/format-assertion-failure.d.cts.map +0 -1
- package/dist/assertion/format-assertion-failure.d.ts +0 -21
- package/dist/assertion/format-assertion-failure.d.ts.map +0 -1
- package/dist/assertion/format-assertion-failure.js +0 -59
- package/dist/assertion/format-assertion-failure.js.map +0 -1
- package/dist/assertion/impl/assertion-util.cjs +0 -68
- package/dist/assertion/impl/assertion-util.cjs.map +0 -1
- package/dist/assertion/impl/assertion-util.d.cts +0 -36
- package/dist/assertion/impl/assertion-util.d.cts.map +0 -1
- package/dist/assertion/impl/assertion-util.d.ts +0 -36
- package/dist/assertion/impl/assertion-util.d.ts.map +0 -1
- package/dist/assertion/impl/assertion-util.js +0 -62
- package/dist/assertion/impl/assertion-util.js.map +0 -1
- package/dist/assertion/impl/async-iterable.cjs +0 -627
- package/dist/assertion/impl/async-iterable.cjs.map +0 -1
- package/dist/assertion/impl/async-iterable.d.cts +0 -406
- package/dist/assertion/impl/async-iterable.d.cts.map +0 -1
- package/dist/assertion/impl/async-iterable.d.ts +0 -406
- package/dist/assertion/impl/async-iterable.d.ts.map +0 -1
- package/dist/assertion/impl/async-iterable.js +0 -624
- package/dist/assertion/impl/async-iterable.js.map +0 -1
- package/dist/assertion/impl/async-parametric.cjs +0 -412
- package/dist/assertion/impl/async-parametric.cjs.map +0 -1
- package/dist/assertion/impl/async-parametric.d.cts +0 -278
- package/dist/assertion/impl/async-parametric.d.cts.map +0 -1
- package/dist/assertion/impl/async-parametric.d.ts +0 -278
- package/dist/assertion/impl/async-parametric.d.ts.map +0 -1
- package/dist/assertion/impl/async-parametric.js +0 -409
- package/dist/assertion/impl/async-parametric.js.map +0 -1
- package/dist/assertion/impl/async.cjs +0 -56
- package/dist/assertion/impl/async.cjs.map +0 -1
- package/dist/assertion/impl/async.d.cts +0 -179
- package/dist/assertion/impl/async.d.cts.map +0 -1
- package/dist/assertion/impl/async.d.ts +0 -179
- package/dist/assertion/impl/async.d.ts.map +0 -1
- package/dist/assertion/impl/async.js +0 -39
- package/dist/assertion/impl/async.js.map +0 -1
- package/dist/assertion/impl/index.cjs +0 -37
- package/dist/assertion/impl/index.cjs.map +0 -1
- package/dist/assertion/impl/index.d.cts +0 -21
- package/dist/assertion/impl/index.d.cts.map +0 -1
- package/dist/assertion/impl/index.d.ts +0 -21
- package/dist/assertion/impl/index.d.ts.map +0 -1
- package/dist/assertion/impl/index.js +0 -21
- package/dist/assertion/impl/index.js.map +0 -1
- package/dist/assertion/impl/iteration-util.cjs +0 -297
- package/dist/assertion/impl/iteration-util.cjs.map +0 -1
- package/dist/assertion/impl/iteration-util.d.cts +0 -12
- package/dist/assertion/impl/iteration-util.d.cts.map +0 -1
- package/dist/assertion/impl/iteration-util.d.ts +0 -12
- package/dist/assertion/impl/iteration-util.d.ts.map +0 -1
- package/dist/assertion/impl/iteration-util.js +0 -282
- package/dist/assertion/impl/iteration-util.js.map +0 -1
- package/dist/assertion/impl/snapshot.cjs +0 -276
- package/dist/assertion/impl/snapshot.cjs.map +0 -1
- package/dist/assertion/impl/snapshot.d.cts +0 -278
- package/dist/assertion/impl/snapshot.d.cts.map +0 -1
- package/dist/assertion/impl/snapshot.d.ts +0 -278
- package/dist/assertion/impl/snapshot.d.ts.map +0 -1
- package/dist/assertion/impl/snapshot.js +0 -273
- package/dist/assertion/impl/snapshot.js.map +0 -1
- package/dist/assertion/impl/sync-basic.cjs +0 -553
- package/dist/assertion/impl/sync-basic.cjs.map +0 -1
- package/dist/assertion/impl/sync-basic.d.cts +0 -528
- package/dist/assertion/impl/sync-basic.d.cts.map +0 -1
- package/dist/assertion/impl/sync-basic.d.ts +0 -528
- package/dist/assertion/impl/sync-basic.d.ts.map +0 -1
- package/dist/assertion/impl/sync-basic.js +0 -550
- package/dist/assertion/impl/sync-basic.js.map +0 -1
- package/dist/assertion/impl/sync-collection.cjs +0 -856
- package/dist/assertion/impl/sync-collection.cjs.map +0 -1
- package/dist/assertion/impl/sync-collection.d.cts +0 -607
- package/dist/assertion/impl/sync-collection.d.cts.map +0 -1
- package/dist/assertion/impl/sync-collection.d.ts +0 -607
- package/dist/assertion/impl/sync-collection.d.ts.map +0 -1
- package/dist/assertion/impl/sync-collection.js +0 -850
- package/dist/assertion/impl/sync-collection.js.map +0 -1
- package/dist/assertion/impl/sync-date.cjs +0 -341
- package/dist/assertion/impl/sync-date.cjs.map +0 -1
- package/dist/assertion/impl/sync-date.d.cts +0 -209
- package/dist/assertion/impl/sync-date.d.cts.map +0 -1
- package/dist/assertion/impl/sync-date.d.ts +0 -209
- package/dist/assertion/impl/sync-date.d.ts.map +0 -1
- package/dist/assertion/impl/sync-date.js +0 -338
- package/dist/assertion/impl/sync-date.js.map +0 -1
- package/dist/assertion/impl/sync-esoteric.cjs +0 -214
- package/dist/assertion/impl/sync-esoteric.cjs.map +0 -1
- package/dist/assertion/impl/sync-esoteric.d.cts +0 -191
- package/dist/assertion/impl/sync-esoteric.d.cts.map +0 -1
- package/dist/assertion/impl/sync-esoteric.d.ts +0 -191
- package/dist/assertion/impl/sync-esoteric.d.ts.map +0 -1
- package/dist/assertion/impl/sync-esoteric.js +0 -211
- package/dist/assertion/impl/sync-esoteric.js.map +0 -1
- package/dist/assertion/impl/sync-iterable.cjs +0 -512
- package/dist/assertion/impl/sync-iterable.cjs.map +0 -1
- package/dist/assertion/impl/sync-iterable.d.cts +0 -334
- package/dist/assertion/impl/sync-iterable.d.cts.map +0 -1
- package/dist/assertion/impl/sync-iterable.d.ts +0 -334
- package/dist/assertion/impl/sync-iterable.d.ts.map +0 -1
- package/dist/assertion/impl/sync-iterable.js +0 -509
- package/dist/assertion/impl/sync-iterable.js.map +0 -1
- package/dist/assertion/impl/sync-parametric.cjs +0 -805
- package/dist/assertion/impl/sync-parametric.cjs.map +0 -1
- package/dist/assertion/impl/sync-parametric.d.cts +0 -560
- package/dist/assertion/impl/sync-parametric.d.cts.map +0 -1
- package/dist/assertion/impl/sync-parametric.d.ts +0 -560
- package/dist/assertion/impl/sync-parametric.d.ts.map +0 -1
- package/dist/assertion/impl/sync-parametric.js +0 -802
- package/dist/assertion/impl/sync-parametric.js.map +0 -1
- package/dist/assertion/impl/sync.cjs +0 -214
- package/dist/assertion/impl/sync.cjs.map +0 -1
- package/dist/assertion/impl/sync.d.cts +0 -512
- package/dist/assertion/impl/sync.d.cts.map +0 -1
- package/dist/assertion/impl/sync.d.ts +0 -512
- package/dist/assertion/impl/sync.d.ts.map +0 -1
- package/dist/assertion/impl/sync.js +0 -197
- package/dist/assertion/impl/sync.js.map +0 -1
- package/dist/assertion/index.cjs +0 -38
- package/dist/assertion/index.cjs.map +0 -1
- package/dist/assertion/index.d.cts +0 -18
- package/dist/assertion/index.d.cts.map +0 -1
- package/dist/assertion/index.d.ts +0 -18
- package/dist/assertion/index.d.ts.map +0 -1
- package/dist/assertion/index.js +0 -17
- package/dist/assertion/index.js.map +0 -1
- package/dist/assertion/slotify.cjs +0 -165
- package/dist/assertion/slotify.cjs.map +0 -1
- package/dist/assertion/slotify.d.cts +0 -11
- package/dist/assertion/slotify.d.cts.map +0 -1
- package/dist/assertion/slotify.d.ts +0 -11
- package/dist/assertion/slotify.d.ts.map +0 -1
- package/dist/assertion/slotify.js +0 -161
- package/dist/assertion/slotify.js.map +0 -1
- package/dist/bootstrap.cjs +0 -43
- package/dist/bootstrap.cjs.map +0 -1
- package/dist/bootstrap.d.cts +0 -27
- package/dist/bootstrap.d.cts.map +0 -1
- package/dist/bootstrap.d.ts +0 -27
- package/dist/bootstrap.d.ts.map +0 -1
- package/dist/bootstrap.js +0 -40
- package/dist/bootstrap.js.map +0 -1
- package/dist/constant.cjs +0 -82
- package/dist/constant.cjs.map +0 -1
- package/dist/constant.d.cts +0 -69
- package/dist/constant.d.cts.map +0 -1
- package/dist/constant.d.ts +0 -69
- package/dist/constant.d.ts.map +0 -1
- package/dist/constant.js +0 -79
- package/dist/constant.js.map +0 -1
- package/dist/diff.cjs +0 -340
- package/dist/diff.cjs.map +0 -1
- package/dist/diff.d.cts +0 -51
- package/dist/diff.d.cts.map +0 -1
- package/dist/diff.d.ts +0 -51
- package/dist/diff.d.ts.map +0 -1
- package/dist/diff.js +0 -334
- package/dist/diff.js.map +0 -1
- package/dist/error.cjs +0 -204
- package/dist/error.cjs.map +0 -1
- package/dist/error.d.cts +0 -212
- package/dist/error.d.cts.map +0 -1
- package/dist/error.d.ts +0 -212
- package/dist/error.d.ts.map +0 -1
- package/dist/error.js +0 -191
- package/dist/error.js.map +0 -1
- package/dist/expect.cjs +0 -590
- package/dist/expect.cjs.map +0 -1
- package/dist/expect.d.cts +0 -138
- package/dist/expect.d.cts.map +0 -1
- package/dist/expect.d.ts +0 -138
- package/dist/expect.d.ts.map +0 -1
- package/dist/expect.js +0 -582
- package/dist/expect.js.map +0 -1
- package/dist/guards.cjs +0 -297
- package/dist/guards.cjs.map +0 -1
- package/dist/guards.d.cts +0 -231
- package/dist/guards.d.cts.map +0 -1
- package/dist/guards.d.ts +0 -231
- package/dist/guards.d.ts.map +0 -1
- package/dist/guards.js +0 -277
- package/dist/guards.js.map +0 -1
- package/dist/index.cjs +0 -111
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -448
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts +0 -448
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -71
- package/dist/index.js.map +0 -1
- package/dist/internal-schema.cjs +0 -253
- package/dist/internal-schema.cjs.map +0 -1
- package/dist/internal-schema.d.cts +0 -8
- package/dist/internal-schema.d.cts.map +0 -1
- package/dist/internal-schema.d.ts +0 -8
- package/dist/internal-schema.d.ts.map +0 -1
- package/dist/internal-schema.js +0 -248
- package/dist/internal-schema.js.map +0 -1
- package/dist/metadata.cjs +0 -57
- package/dist/metadata.cjs.map +0 -1
- package/dist/metadata.d.cts +0 -27
- package/dist/metadata.d.cts.map +0 -1
- package/dist/metadata.d.ts +0 -27
- package/dist/metadata.d.ts.map +0 -1
- package/dist/metadata.js +0 -54
- package/dist/metadata.js.map +0 -1
- package/dist/schema.cjs +0 -1522
- package/dist/schema.cjs.map +0 -1
- package/dist/schema.d.cts +0 -1196
- package/dist/schema.d.cts.map +0 -1
- package/dist/schema.d.ts +0 -1196
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -1516
- package/dist/schema.js.map +0 -1
- package/dist/snapshot/adapter.cjs +0 -31
- package/dist/snapshot/adapter.cjs.map +0 -1
- package/dist/snapshot/adapter.d.cts +0 -258
- package/dist/snapshot/adapter.d.cts.map +0 -1
- package/dist/snapshot/adapter.d.ts +0 -258
- package/dist/snapshot/adapter.d.ts.map +0 -1
- package/dist/snapshot/adapter.js +0 -27
- package/dist/snapshot/adapter.js.map +0 -1
- package/dist/snapshot/adapters/fallback.cjs +0 -453
- package/dist/snapshot/adapters/fallback.cjs.map +0 -1
- package/dist/snapshot/adapters/fallback.d.cts +0 -185
- package/dist/snapshot/adapters/fallback.d.cts.map +0 -1
- package/dist/snapshot/adapters/fallback.d.ts +0 -185
- package/dist/snapshot/adapters/fallback.d.ts.map +0 -1
- package/dist/snapshot/adapters/fallback.js +0 -446
- package/dist/snapshot/adapters/fallback.js.map +0 -1
- package/dist/snapshot/adapters/node-test.cjs +0 -301
- package/dist/snapshot/adapters/node-test.cjs.map +0 -1
- package/dist/snapshot/adapters/node-test.d.cts +0 -131
- package/dist/snapshot/adapters/node-test.d.cts.map +0 -1
- package/dist/snapshot/adapters/node-test.d.ts +0 -131
- package/dist/snapshot/adapters/node-test.d.ts.map +0 -1
- package/dist/snapshot/adapters/node-test.js +0 -297
- package/dist/snapshot/adapters/node-test.js.map +0 -1
- package/dist/snapshot/index.cjs +0 -61
- package/dist/snapshot/index.cjs.map +0 -1
- package/dist/snapshot/index.d.cts +0 -40
- package/dist/snapshot/index.d.cts.map +0 -1
- package/dist/snapshot/index.d.ts +0 -40
- package/dist/snapshot/index.d.ts.map +0 -1
- package/dist/snapshot/index.js +0 -44
- package/dist/snapshot/index.js.map +0 -1
- package/dist/snapshot/node-version.cjs +0 -49
- package/dist/snapshot/node-version.cjs.map +0 -1
- package/dist/snapshot/node-version.d.cts +0 -34
- package/dist/snapshot/node-version.d.cts.map +0 -1
- package/dist/snapshot/node-version.d.ts +0 -34
- package/dist/snapshot/node-version.d.ts.map +0 -1
- package/dist/snapshot/node-version.js +0 -44
- package/dist/snapshot/node-version.js.map +0 -1
- package/dist/snapshot/select-adapter.cjs +0 -170
- package/dist/snapshot/select-adapter.cjs.map +0 -1
- package/dist/snapshot/select-adapter.d.cts +0 -128
- package/dist/snapshot/select-adapter.d.cts.map +0 -1
- package/dist/snapshot/select-adapter.d.ts +0 -128
- package/dist/snapshot/select-adapter.d.ts.map +0 -1
- package/dist/snapshot/select-adapter.js +0 -164
- package/dist/snapshot/select-adapter.js.map +0 -1
- package/dist/snapshot/serializer.cjs +0 -246
- package/dist/snapshot/serializer.cjs.map +0 -1
- package/dist/snapshot/serializer.d.cts +0 -126
- package/dist/snapshot/serializer.d.cts.map +0 -1
- package/dist/snapshot/serializer.d.ts +0 -126
- package/dist/snapshot/serializer.d.ts.map +0 -1
- package/dist/snapshot/serializer.js +0 -238
- package/dist/snapshot/serializer.js.map +0 -1
- package/dist/standard-schema.cjs +0 -13
- package/dist/standard-schema.cjs.map +0 -1
- package/dist/standard-schema.d.cts +0 -192
- package/dist/standard-schema.d.cts.map +0 -1
- package/dist/standard-schema.d.ts +0 -192
- package/dist/standard-schema.d.ts.map +0 -1
- package/dist/standard-schema.js +0 -12
- package/dist/standard-schema.js.map +0 -1
- package/dist/types.cjs +0 -22
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.cts +0 -905
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.ts +0 -905
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -21
- package/dist/types.js.map +0 -1
- package/dist/use.cjs +0 -240
- package/dist/use.cjs.map +0 -1
- package/dist/use.d.cts +0 -8
- package/dist/use.d.cts.map +0 -1
- package/dist/use.d.ts +0 -8
- package/dist/use.d.ts.map +0 -1
- package/dist/use.js +0 -236
- package/dist/use.js.map +0 -1
- package/dist/util.cjs +0 -255
- package/dist/util.cjs.map +0 -1
- package/dist/util.d.cts +0 -141
- package/dist/util.d.cts.map +0 -1
- package/dist/util.d.ts +0 -141
- package/dist/util.d.ts.map +0 -1
- package/dist/util.js +0 -234
- package/dist/util.js.map +0 -1
- package/dist/value-to-schema.cjs +0 -537
- package/dist/value-to-schema.cjs.map +0 -1
- package/dist/value-to-schema.d.cts +0 -144
- package/dist/value-to-schema.d.cts.map +0 -1
- package/dist/value-to-schema.d.ts +0 -144
- package/dist/value-to-schema.d.ts.map +0 -1
- package/dist/value-to-schema.js +0 -533
- package/dist/value-to-schema.js.map +0 -1
|
@@ -1,509 +0,0 @@
|
|
|
1
|
-
// do not remove; otherwise zshy will not resolve the .d.ts file; it must be referenced directly
|
|
2
|
-
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
3
|
-
/// <reference path="./shims.d.ts" />
|
|
4
|
-
/**
|
|
5
|
-
* Iterable assertions for synchronous iterables and iterators.
|
|
6
|
-
*
|
|
7
|
-
* These assertions test iterables using the **iteration protocol**
|
|
8
|
-
* (`Symbol.iterator`), as opposed to collection assertions which use native
|
|
9
|
-
* collection APIs. This distinction matters when a subject has custom
|
|
10
|
-
* `Symbol.iterator` behavior that differs from its collection API.
|
|
11
|
-
*
|
|
12
|
-
* @packageDocumentation
|
|
13
|
-
* @groupDescription Sync Iterable Assertions
|
|
14
|
-
* Assertions for synchronous iterables and iterators using the iteration protocol.
|
|
15
|
-
*
|
|
16
|
-
* @showGroup
|
|
17
|
-
*/
|
|
18
|
-
import { inspect } from 'node:util';
|
|
19
|
-
import { z } from 'zod';
|
|
20
|
-
import { NonNegativeIntegerSchema, SyncIterableOrIteratorSchema, UnknownSchema, } from "../../schema.js";
|
|
21
|
-
import { valueToSchema, valueToSchemaOptionsForDeepEqual, valueToSchemaOptionsForSatisfies, } from "../../value-to-schema.js";
|
|
22
|
-
import { createAssertion } from "../create.js";
|
|
23
|
-
import { collectSync, countSync, iterateFullySync, toIterator, } from "./iteration-util.js";
|
|
24
|
-
// =============================================================================
|
|
25
|
-
// 'to yield' assertions - check if ANY item matches
|
|
26
|
-
// =============================================================================
|
|
27
|
-
/**
|
|
28
|
-
* Asserts that an iterable yields a value satisfying the expected shape.
|
|
29
|
-
*
|
|
30
|
-
* Uses partial/satisfy semantics (like `'to satisfy'`). The assertion passes if
|
|
31
|
-
* ANY yielded value matches the expected shape.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
*
|
|
35
|
-
* ```ts
|
|
36
|
-
* expect([{ a: 1, b: 2 }], 'to yield', { a: 1 }); // passes (partial match)
|
|
37
|
-
* expect([1, 2, 3], 'to emit', 2); // passes
|
|
38
|
-
* expect(myGenerator(), 'to yield value satisfying', { name: 'test' }); // passes
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @group Sync Iterable Assertions
|
|
42
|
-
* @bupkisAnchor iterable-to-yield-any
|
|
43
|
-
* @bupkisAssertionCategory iterable
|
|
44
|
-
*/
|
|
45
|
-
export const iterableYieldsAssertion = createAssertion([
|
|
46
|
-
SyncIterableOrIteratorSchema,
|
|
47
|
-
['to yield', 'to emit', 'to yield value satisfying'],
|
|
48
|
-
UnknownSchema,
|
|
49
|
-
], (subject, expected) => {
|
|
50
|
-
const iterator = toIterator(subject);
|
|
51
|
-
const schema = valueToSchema(expected, valueToSchemaOptionsForSatisfies);
|
|
52
|
-
let next = iterator.next();
|
|
53
|
-
while (!next.done) {
|
|
54
|
-
if (schema.safeParse(next.value).success) {
|
|
55
|
-
return; // success - found a matching value
|
|
56
|
-
}
|
|
57
|
-
next = iterator.next();
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
message: `Expected iterable to yield a value satisfying ${inspect(expected)}, but none matched`,
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
/**
|
|
64
|
-
* Asserts that an iterable yields a value exhaustively matching the expected
|
|
65
|
-
* value.
|
|
66
|
-
*
|
|
67
|
-
* Uses deep equality semantics (like `'to equal'`). Extra properties on yielded
|
|
68
|
-
* values cause failure.
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
*
|
|
72
|
-
* ```ts
|
|
73
|
-
* expect([{ a: 1 }], 'to yield value exhaustively satisfying', { a: 1 }); // passes
|
|
74
|
-
* expect([{ a: 1, b: 2 }], 'to yield value exhaustively satisfying', {
|
|
75
|
-
* a: 1,
|
|
76
|
-
* }); // fails (extra prop)
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @group Sync Iterable Assertions
|
|
80
|
-
* @bupkisAnchor iterable-to-yield-value-exhaustively-satisfying-any
|
|
81
|
-
* @bupkisAssertionCategory iterable
|
|
82
|
-
*/
|
|
83
|
-
export const iterableYieldsExhaustivelyAssertion = createAssertion([
|
|
84
|
-
SyncIterableOrIteratorSchema,
|
|
85
|
-
'to yield value exhaustively satisfying',
|
|
86
|
-
UnknownSchema,
|
|
87
|
-
], (subject, expected) => {
|
|
88
|
-
const iterator = toIterator(subject);
|
|
89
|
-
const schema = valueToSchema(expected, valueToSchemaOptionsForDeepEqual);
|
|
90
|
-
let next = iterator.next();
|
|
91
|
-
while (!next.done) {
|
|
92
|
-
if (schema.safeParse(next.value).success) {
|
|
93
|
-
return; // success - found an exact match
|
|
94
|
-
}
|
|
95
|
-
next = iterator.next();
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
message: `Expected iterable to yield a value exhaustively satisfying ${inspect(expected)}, but none matched`,
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
// =============================================================================
|
|
102
|
-
// 'to yield items satisfying' - ALL items must match
|
|
103
|
-
// =============================================================================
|
|
104
|
-
/**
|
|
105
|
-
* Asserts that ALL yielded values individually satisfy the expected shape.
|
|
106
|
-
*
|
|
107
|
-
* Uses partial/satisfy semantics. Every item yielded must match.
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
*
|
|
111
|
-
* ```ts
|
|
112
|
-
* expect([{ a: 1 }, { a: 2, b: 3 }], 'to yield items satisfying', {
|
|
113
|
-
* a: z.number(),
|
|
114
|
-
* }); // passes
|
|
115
|
-
* expect([1, 2, 3], 'to yield items satisfying', z.number()); // passes
|
|
116
|
-
* ```
|
|
117
|
-
*
|
|
118
|
-
* @group Sync Iterable Assertions
|
|
119
|
-
* @bupkisAnchor iterable-to-yield-items-satisfying-any
|
|
120
|
-
* @bupkisAssertionCategory iterable
|
|
121
|
-
*/
|
|
122
|
-
export const iterableYieldsItemsSatisfyingAssertion = createAssertion([SyncIterableOrIteratorSchema, 'to yield items satisfying', UnknownSchema], (subject, expected) => {
|
|
123
|
-
const iterator = toIterator(subject);
|
|
124
|
-
const schema = valueToSchema(expected, valueToSchemaOptionsForSatisfies);
|
|
125
|
-
let index = 0;
|
|
126
|
-
let next = iterator.next();
|
|
127
|
-
while (!next.done) {
|
|
128
|
-
const result = schema.safeParse(next.value);
|
|
129
|
-
if (!result.success) {
|
|
130
|
-
return {
|
|
131
|
-
message: `Expected all items to satisfy ${inspect(expected)}, but item at index ${index} did not match: ${inspect(next.value)}`,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
index++;
|
|
135
|
-
next = iterator.next();
|
|
136
|
-
}
|
|
137
|
-
// Empty iterables trivially satisfy (vacuous truth)
|
|
138
|
-
});
|
|
139
|
-
/**
|
|
140
|
-
* Asserts that ALL yielded values individually match with deep equality.
|
|
141
|
-
*
|
|
142
|
-
* Uses strict equality semantics. Every item yielded must exactly match.
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
*
|
|
146
|
-
* ```ts
|
|
147
|
-
* expect([{ a: 1 }, { a: 1 }], 'to yield items exhaustively satisfying', {
|
|
148
|
-
* a: 1,
|
|
149
|
-
* }); // passes
|
|
150
|
-
* expect([{ a: 1, b: 2 }], 'to yield items exhaustively satisfying', {
|
|
151
|
-
* a: 1,
|
|
152
|
-
* }); // fails
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* @group Sync Iterable Assertions
|
|
156
|
-
* @bupkisAnchor iterable-to-yield-items-exhaustively-satisfying-any
|
|
157
|
-
* @bupkisAssertionCategory iterable
|
|
158
|
-
*/
|
|
159
|
-
export const iterableYieldsItemsExhaustivelyAssertion = createAssertion([
|
|
160
|
-
SyncIterableOrIteratorSchema,
|
|
161
|
-
'to yield items exhaustively satisfying',
|
|
162
|
-
UnknownSchema,
|
|
163
|
-
], (subject, expected) => {
|
|
164
|
-
const iterator = toIterator(subject);
|
|
165
|
-
const schema = valueToSchema(expected, valueToSchemaOptionsForDeepEqual);
|
|
166
|
-
let index = 0;
|
|
167
|
-
let next = iterator.next();
|
|
168
|
-
while (!next.done) {
|
|
169
|
-
const result = schema.safeParse(next.value);
|
|
170
|
-
if (!result.success) {
|
|
171
|
-
return {
|
|
172
|
-
message: `Expected all items to exhaustively satisfy ${inspect(expected)}, but item at index ${index} did not match: ${inspect(next.value)}`,
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
index++;
|
|
176
|
-
next = iterator.next();
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
// =============================================================================
|
|
180
|
-
// First/Last assertions
|
|
181
|
-
// =============================================================================
|
|
182
|
-
/**
|
|
183
|
-
* Asserts that the first yielded value satisfies the expected shape.
|
|
184
|
-
*
|
|
185
|
-
* Uses partial/satisfy semantics.
|
|
186
|
-
*
|
|
187
|
-
* @example
|
|
188
|
-
*
|
|
189
|
-
* ```ts
|
|
190
|
-
* expect([{ a: 1, b: 2 }, { c: 3 }], 'to yield first', { a: 1 }); // passes
|
|
191
|
-
* expect([1, 2, 3], 'to yield first satisfying', 1); // passes
|
|
192
|
-
* ```
|
|
193
|
-
*
|
|
194
|
-
* @group Sync Iterable Assertions
|
|
195
|
-
* @bupkisAnchor iterable-to-yield-first-any
|
|
196
|
-
* @bupkisAssertionCategory iterable
|
|
197
|
-
*/
|
|
198
|
-
export const iterableYieldsFirstAssertion = createAssertion([
|
|
199
|
-
SyncIterableOrIteratorSchema,
|
|
200
|
-
['to yield first', 'to yield first satisfying'],
|
|
201
|
-
UnknownSchema,
|
|
202
|
-
], (subject, expected) => {
|
|
203
|
-
// Only call toIterator once to avoid exhausting raw iterators
|
|
204
|
-
const iterator = toIterator(subject);
|
|
205
|
-
const result = iterator.next();
|
|
206
|
-
if (result.done) {
|
|
207
|
-
return {
|
|
208
|
-
message: 'Expected iterable to yield at least one value, but it was empty',
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
const schema = valueToSchema(expected, valueToSchemaOptionsForSatisfies);
|
|
212
|
-
if (!schema.safeParse(result.value).success) {
|
|
213
|
-
return {
|
|
214
|
-
message: `Expected first yielded value to satisfy ${inspect(expected)}, but got ${inspect(result.value)}`,
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
/**
|
|
219
|
-
* Asserts that the first yielded value exhaustively matches.
|
|
220
|
-
*
|
|
221
|
-
* Uses deep equality semantics.
|
|
222
|
-
*
|
|
223
|
-
* @example
|
|
224
|
-
*
|
|
225
|
-
* ```ts
|
|
226
|
-
* expect([{ a: 1 }], 'to yield first exhaustively satisfying', { a: 1 }); // passes
|
|
227
|
-
* expect([{ a: 1, b: 2 }], 'to yield first exhaustively satisfying', {
|
|
228
|
-
* a: 1,
|
|
229
|
-
* }); // fails
|
|
230
|
-
* ```
|
|
231
|
-
*
|
|
232
|
-
* @group Sync Iterable Assertions
|
|
233
|
-
* @bupkisAnchor iterable-to-yield-first-exhaustively-satisfying-any
|
|
234
|
-
* @bupkisAssertionCategory iterable
|
|
235
|
-
*/
|
|
236
|
-
export const iterableYieldsFirstExhaustivelyAssertion = createAssertion([
|
|
237
|
-
SyncIterableOrIteratorSchema,
|
|
238
|
-
'to yield first exhaustively satisfying',
|
|
239
|
-
UnknownSchema,
|
|
240
|
-
], (subject, expected) => {
|
|
241
|
-
const iterator = toIterator(subject);
|
|
242
|
-
const result = iterator.next();
|
|
243
|
-
if (result.done) {
|
|
244
|
-
return {
|
|
245
|
-
message: 'Expected iterable to yield at least one value, but it was empty',
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
const schema = valueToSchema(expected, valueToSchemaOptionsForDeepEqual);
|
|
249
|
-
if (!schema.safeParse(result.value).success) {
|
|
250
|
-
return {
|
|
251
|
-
message: `Expected first yielded value to exhaustively satisfy ${inspect(expected)}, but got ${inspect(result.value)}`,
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
/**
|
|
256
|
-
* Asserts that the last yielded value satisfies the expected shape.
|
|
257
|
-
*
|
|
258
|
-
* Uses partial/satisfy semantics. Note: fully consumes the iterator.
|
|
259
|
-
*
|
|
260
|
-
* @example
|
|
261
|
-
*
|
|
262
|
-
* ```ts
|
|
263
|
-
* expect([{ a: 1 }, { b: 2, c: 3 }], 'to yield last', { b: 2 }); // passes
|
|
264
|
-
* expect([1, 2, 3], 'to yield last satisfying', 3); // passes
|
|
265
|
-
* ```
|
|
266
|
-
*
|
|
267
|
-
* @group Sync Iterable Assertions
|
|
268
|
-
* @bupkisAnchor iterable-to-yield-last-any
|
|
269
|
-
* @bupkisAssertionCategory iterable
|
|
270
|
-
*/
|
|
271
|
-
export const iterableYieldsLastAssertion = createAssertion([
|
|
272
|
-
SyncIterableOrIteratorSchema,
|
|
273
|
-
['to yield last', 'to yield last satisfying'],
|
|
274
|
-
UnknownSchema,
|
|
275
|
-
], (subject, expected) => {
|
|
276
|
-
const { hasValue, lastValue } = iterateFullySync(subject);
|
|
277
|
-
if (!hasValue) {
|
|
278
|
-
return {
|
|
279
|
-
message: 'Expected iterable to yield at least one value, but it was empty',
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
const schema = valueToSchema(expected, valueToSchemaOptionsForSatisfies);
|
|
283
|
-
if (!schema.safeParse(lastValue).success) {
|
|
284
|
-
return {
|
|
285
|
-
message: `Expected last yielded value to satisfy ${inspect(expected)}, but got ${inspect(lastValue)}`,
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
/**
|
|
290
|
-
* Asserts that the last yielded value exhaustively matches.
|
|
291
|
-
*
|
|
292
|
-
* Uses deep equality semantics. Note: fully consumes the iterator.
|
|
293
|
-
*
|
|
294
|
-
* @example
|
|
295
|
-
*
|
|
296
|
-
* ```ts
|
|
297
|
-
* expect([{ a: 1 }, { b: 2 }], 'to yield last exhaustively satisfying', {
|
|
298
|
-
* b: 2,
|
|
299
|
-
* }); // passes
|
|
300
|
-
* expect(
|
|
301
|
-
* [{ a: 1, extra: true }],
|
|
302
|
-
* 'to yield last exhaustively satisfying',
|
|
303
|
-
* { a: 1 },
|
|
304
|
-
* ); // fails
|
|
305
|
-
* ```
|
|
306
|
-
*
|
|
307
|
-
* @group Sync Iterable Assertions
|
|
308
|
-
* @bupkisAnchor iterable-to-yield-last-exhaustively-satisfying-any
|
|
309
|
-
* @bupkisAssertionCategory iterable
|
|
310
|
-
*/
|
|
311
|
-
export const iterableYieldsLastExhaustivelyAssertion = createAssertion([
|
|
312
|
-
SyncIterableOrIteratorSchema,
|
|
313
|
-
'to yield last exhaustively satisfying',
|
|
314
|
-
UnknownSchema,
|
|
315
|
-
], (subject, expected) => {
|
|
316
|
-
const { hasValue, lastValue } = iterateFullySync(subject);
|
|
317
|
-
if (!hasValue) {
|
|
318
|
-
return {
|
|
319
|
-
message: 'Expected iterable to yield at least one value, but it was empty',
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
const schema = valueToSchema(expected, valueToSchemaOptionsForDeepEqual);
|
|
323
|
-
if (!schema.safeParse(lastValue).success) {
|
|
324
|
-
return {
|
|
325
|
-
message: `Expected last yielded value to exhaustively satisfy ${inspect(expected)}, but got ${inspect(lastValue)}`,
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
// =============================================================================
|
|
330
|
-
// Cardinality assertions
|
|
331
|
-
// =============================================================================
|
|
332
|
-
/**
|
|
333
|
-
* Asserts that an iterable yields exactly the specified count of values.
|
|
334
|
-
*
|
|
335
|
-
* @example
|
|
336
|
-
*
|
|
337
|
-
* ```ts
|
|
338
|
-
* expect([1, 2, 3], 'to yield count', 3); // passes
|
|
339
|
-
* expect(new Set([1, 2]), 'to yield count', 2); // passes
|
|
340
|
-
* ```
|
|
341
|
-
*
|
|
342
|
-
* @group Sync Iterable Assertions
|
|
343
|
-
* @bupkisAnchor iterable-to-yield-count-number
|
|
344
|
-
* @bupkisAssertionCategory iterable
|
|
345
|
-
*/
|
|
346
|
-
export const iterableYieldsCountAssertion = createAssertion([SyncIterableOrIteratorSchema, 'to yield count', NonNegativeIntegerSchema], (subject, expectedCount) => {
|
|
347
|
-
const actual = countSync(subject);
|
|
348
|
-
if (actual !== expectedCount) {
|
|
349
|
-
return {
|
|
350
|
-
actual,
|
|
351
|
-
expected: expectedCount,
|
|
352
|
-
message: `Expected iterable to yield ${expectedCount} value(s), but yielded ${actual}`,
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
/**
|
|
357
|
-
* Asserts that an iterable yields at least the specified count of values.
|
|
358
|
-
*
|
|
359
|
-
* @example
|
|
360
|
-
*
|
|
361
|
-
* ```ts
|
|
362
|
-
* expect([1, 2, 3], 'to yield at least', 2); // passes
|
|
363
|
-
* expect([1], 'to yield at least', 2); // fails
|
|
364
|
-
* ```
|
|
365
|
-
*
|
|
366
|
-
* @group Sync Iterable Assertions
|
|
367
|
-
* @bupkisAnchor iterable-to-yield-at-least-number
|
|
368
|
-
* @bupkisAssertionCategory iterable
|
|
369
|
-
*/
|
|
370
|
-
export const iterableYieldsAtLeastAssertion = createAssertion([SyncIterableOrIteratorSchema, 'to yield at least', NonNegativeIntegerSchema], (subject, minCount) => {
|
|
371
|
-
const actual = countSync(subject);
|
|
372
|
-
if (actual < minCount) {
|
|
373
|
-
return {
|
|
374
|
-
actual,
|
|
375
|
-
expected: `at least ${minCount}`,
|
|
376
|
-
message: `Expected iterable to yield at least ${minCount} value(s), but yielded ${actual}`,
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
/**
|
|
381
|
-
* Asserts that an iterable yields at most the specified count of values.
|
|
382
|
-
*
|
|
383
|
-
* @example
|
|
384
|
-
*
|
|
385
|
-
* ```ts
|
|
386
|
-
* expect([1, 2], 'to yield at most', 3); // passes
|
|
387
|
-
* expect([1, 2, 3, 4], 'to yield at most', 3); // fails
|
|
388
|
-
* ```
|
|
389
|
-
*
|
|
390
|
-
* @group Sync Iterable Assertions
|
|
391
|
-
* @bupkisAnchor iterable-to-yield-at-most-number
|
|
392
|
-
* @bupkisAssertionCategory iterable
|
|
393
|
-
*/
|
|
394
|
-
export const iterableYieldsAtMostAssertion = createAssertion([SyncIterableOrIteratorSchema, 'to yield at most', NonNegativeIntegerSchema], (subject, maxCount) => {
|
|
395
|
-
const actual = countSync(subject);
|
|
396
|
-
if (actual > maxCount) {
|
|
397
|
-
return {
|
|
398
|
-
actual,
|
|
399
|
-
expected: `at most ${maxCount}`,
|
|
400
|
-
message: `Expected iterable to yield at most ${maxCount} value(s), but yielded ${actual}`,
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
/**
|
|
405
|
-
* Asserts that an iterable yields nothing (is empty).
|
|
406
|
-
*
|
|
407
|
-
* @remarks
|
|
408
|
-
* Use `'not to be an empty iterable'` or `'to yield at least', 1` for non-empty
|
|
409
|
-
* assertions.
|
|
410
|
-
* @example
|
|
411
|
-
*
|
|
412
|
-
* ```ts
|
|
413
|
-
* expect([], 'to be an empty iterable'); // passes
|
|
414
|
-
* expect(new Set(), 'to be an empty iterable'); // passes
|
|
415
|
-
* expect([1], 'to be an empty iterable'); // fails
|
|
416
|
-
* ```
|
|
417
|
-
*
|
|
418
|
-
* @group Sync Iterable Assertions
|
|
419
|
-
* @bupkisAnchor iterable-to-be-an-empty-iterable
|
|
420
|
-
* @bupkisAssertionCategory iterable
|
|
421
|
-
*/
|
|
422
|
-
export const iterableEmptyAssertion = createAssertion([SyncIterableOrIteratorSchema, 'to be an empty iterable'], (subject) => {
|
|
423
|
-
const iterator = toIterator(subject);
|
|
424
|
-
const result = iterator.next();
|
|
425
|
-
if (!result.done) {
|
|
426
|
-
return {
|
|
427
|
-
message: `Expected iterable to be empty, but it yielded at least one value: ${inspect(result.value)}`,
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
// =============================================================================
|
|
432
|
-
// Sequence/Collection assertions
|
|
433
|
-
// =============================================================================
|
|
434
|
-
/**
|
|
435
|
-
* Asserts that an iterable yields exactly the specified values in order.
|
|
436
|
-
*
|
|
437
|
-
* Uses deep equality semantics. The iterable must yield the exact same number
|
|
438
|
-
* of values in the exact same order.
|
|
439
|
-
*
|
|
440
|
-
* @example
|
|
441
|
-
*
|
|
442
|
-
* ```ts
|
|
443
|
-
* expect([1, 2, 3], 'to yield exactly', [1, 2, 3]); // passes
|
|
444
|
-
* expect([{ a: 1, b: 2 }], 'to yield exactly', [{ a: 1 }]); // fails (extra prop)
|
|
445
|
-
* ```
|
|
446
|
-
*
|
|
447
|
-
* @group Sync Iterable Assertions
|
|
448
|
-
* @bupkisAnchor iterable-to-yield-exactly-array
|
|
449
|
-
* @bupkisAssertionCategory iterable
|
|
450
|
-
*/
|
|
451
|
-
export const iterableYieldsExactlyAssertion = createAssertion([SyncIterableOrIteratorSchema, 'to yield exactly', z.array(UnknownSchema)], (subject, expected) => {
|
|
452
|
-
const actual = collectSync(subject);
|
|
453
|
-
const schema = valueToSchema(expected, valueToSchemaOptionsForDeepEqual);
|
|
454
|
-
return { schema, subject: actual };
|
|
455
|
-
});
|
|
456
|
-
/**
|
|
457
|
-
* Asserts that an iterable yields values that satisfy the expected sequence.
|
|
458
|
-
*
|
|
459
|
-
* Uses satisfy/partial matching semantics on the collected array.
|
|
460
|
-
*
|
|
461
|
-
* @example
|
|
462
|
-
*
|
|
463
|
-
* ```ts
|
|
464
|
-
* expect([{ a: 1, b: 2 }], 'to yield sequence satisfying', [{ a: 1 }]); // passes
|
|
465
|
-
* expect([1, 2, 3], 'to yield array satisfying', [1, 2, 3]); // passes
|
|
466
|
-
* ```
|
|
467
|
-
*
|
|
468
|
-
* @group Sync Iterable Assertions
|
|
469
|
-
* @bupkisAnchor iterable-to-yield-sequence-satisfying-array
|
|
470
|
-
* @bupkisAssertionCategory iterable
|
|
471
|
-
*/
|
|
472
|
-
export const iterableYieldsSequenceSatisfyingAssertion = createAssertion([
|
|
473
|
-
SyncIterableOrIteratorSchema,
|
|
474
|
-
['to yield sequence satisfying', 'to yield array satisfying'],
|
|
475
|
-
z.array(UnknownSchema),
|
|
476
|
-
], (subject, expected) => {
|
|
477
|
-
const actual = collectSync(subject);
|
|
478
|
-
const schema = valueToSchema(expected, valueToSchemaOptionsForSatisfies);
|
|
479
|
-
return { schema, subject: actual };
|
|
480
|
-
});
|
|
481
|
-
// =============================================================================
|
|
482
|
-
// Export all sync iterable assertions as a tuple
|
|
483
|
-
// =============================================================================
|
|
484
|
-
/**
|
|
485
|
-
* All synchronous iterable assertions bundled as a tuple for convenient
|
|
486
|
-
* registration.
|
|
487
|
-
*/
|
|
488
|
-
export const SyncIterableAssertions = [
|
|
489
|
-
// 'to yield' - any item matches
|
|
490
|
-
iterableYieldsAssertion,
|
|
491
|
-
iterableYieldsExhaustivelyAssertion,
|
|
492
|
-
// 'to yield items' - all items must match
|
|
493
|
-
iterableYieldsItemsSatisfyingAssertion,
|
|
494
|
-
iterableYieldsItemsExhaustivelyAssertion,
|
|
495
|
-
// First/last assertions
|
|
496
|
-
iterableYieldsFirstAssertion,
|
|
497
|
-
iterableYieldsFirstExhaustivelyAssertion,
|
|
498
|
-
iterableYieldsLastAssertion,
|
|
499
|
-
iterableYieldsLastExhaustivelyAssertion,
|
|
500
|
-
// Cardinality
|
|
501
|
-
iterableYieldsCountAssertion,
|
|
502
|
-
iterableYieldsAtLeastAssertion,
|
|
503
|
-
iterableYieldsAtMostAssertion,
|
|
504
|
-
iterableEmptyAssertion,
|
|
505
|
-
// Sequence
|
|
506
|
-
iterableYieldsExactlyAssertion,
|
|
507
|
-
iterableYieldsSequenceSatisfyingAssertion,
|
|
508
|
-
];
|
|
509
|
-
//# sourceMappingURL=sync-iterable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync-iterable.js","sourceRoot":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