bupkis 0.18.2 → 1.0.0
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 +29 -0
- package/README.md +1 -1
- package/dist/assertion/assertion-async.cjs +268 -0
- package/dist/assertion/assertion-async.cjs.map +1 -0
- package/dist/assertion/assertion-async.d.cts +40 -0
- package/dist/assertion/assertion-async.d.cts.map +1 -0
- package/dist/assertion/assertion-async.d.ts +40 -0
- package/dist/assertion/assertion-async.d.ts.map +1 -0
- package/dist/assertion/assertion-async.js +259 -0
- package/dist/assertion/assertion-async.js.map +1 -0
- package/dist/assertion/assertion-standard-schema-async.cjs +132 -0
- package/dist/assertion/assertion-standard-schema-async.cjs.map +1 -0
- package/dist/assertion/assertion-standard-schema-async.d.cts +52 -0
- package/dist/assertion/assertion-standard-schema-async.d.cts.map +1 -0
- package/dist/assertion/assertion-standard-schema-async.d.ts +52 -0
- package/dist/assertion/assertion-standard-schema-async.d.ts.map +1 -0
- package/dist/assertion/assertion-standard-schema-async.js +128 -0
- package/dist/assertion/assertion-standard-schema-async.js.map +1 -0
- package/dist/assertion/assertion-standard-schema-sync.cjs +141 -0
- package/dist/assertion/assertion-standard-schema-sync.cjs.map +1 -0
- package/dist/assertion/assertion-standard-schema-sync.d.cts +52 -0
- package/dist/assertion/assertion-standard-schema-sync.d.cts.map +1 -0
- package/dist/assertion/assertion-standard-schema-sync.d.ts +52 -0
- package/dist/assertion/assertion-standard-schema-sync.d.ts.map +1 -0
- package/dist/assertion/assertion-standard-schema-sync.js +137 -0
- package/dist/assertion/assertion-standard-schema-sync.js.map +1 -0
- package/dist/assertion/assertion-sync.cjs +281 -0
- package/dist/assertion/assertion-sync.cjs.map +1 -0
- package/dist/assertion/assertion-sync.d.cts +60 -0
- package/dist/assertion/assertion-sync.d.cts.map +1 -0
- package/dist/assertion/assertion-sync.d.ts +60 -0
- package/dist/assertion/assertion-sync.d.ts.map +1 -0
- package/dist/assertion/assertion-sync.js +275 -0
- package/dist/assertion/assertion-sync.js.map +1 -0
- package/dist/assertion/assertion-types.cjs +20 -0
- package/dist/assertion/assertion-types.cjs.map +1 -0
- package/dist/assertion/assertion-types.d.cts +1086 -0
- package/dist/assertion/assertion-types.d.cts.map +1 -0
- package/dist/assertion/assertion-types.d.ts +1086 -0
- package/dist/assertion/assertion-types.d.ts.map +1 -0
- package/dist/assertion/assertion-types.js +19 -0
- package/dist/assertion/assertion-types.js.map +1 -0
- package/dist/assertion/assertion.cjs +382 -0
- package/dist/assertion/assertion.cjs.map +1 -0
- package/dist/assertion/assertion.d.cts +109 -0
- package/dist/assertion/assertion.d.cts.map +1 -0
- package/dist/assertion/assertion.d.ts +109 -0
- package/dist/assertion/assertion.d.ts.map +1 -0
- package/dist/assertion/assertion.js +375 -0
- package/dist/assertion/assertion.js.map +1 -0
- package/dist/assertion/create.cjs +148 -0
- package/dist/assertion/create.cjs.map +1 -0
- package/dist/assertion/create.d.cts +85 -0
- package/dist/assertion/create.d.cts.map +1 -0
- package/dist/assertion/create.d.ts +85 -0
- package/dist/assertion/create.d.ts.map +1 -0
- package/dist/assertion/create.js +143 -0
- package/dist/assertion/create.js.map +1 -0
- package/dist/assertion/format-assertion-failure.cjs +63 -0
- package/dist/assertion/format-assertion-failure.cjs.map +1 -0
- package/dist/assertion/format-assertion-failure.d.cts +21 -0
- package/dist/assertion/format-assertion-failure.d.cts.map +1 -0
- package/dist/assertion/format-assertion-failure.d.ts +21 -0
- package/dist/assertion/format-assertion-failure.d.ts.map +1 -0
- package/dist/assertion/format-assertion-failure.js +59 -0
- package/dist/assertion/format-assertion-failure.js.map +1 -0
- package/dist/assertion/impl/assertion-util.cjs +68 -0
- package/dist/assertion/impl/assertion-util.cjs.map +1 -0
- package/dist/assertion/impl/assertion-util.d.cts +36 -0
- package/dist/assertion/impl/assertion-util.d.cts.map +1 -0
- package/dist/assertion/impl/assertion-util.d.ts +36 -0
- package/dist/assertion/impl/assertion-util.d.ts.map +1 -0
- package/dist/assertion/impl/assertion-util.js +62 -0
- package/dist/assertion/impl/assertion-util.js.map +1 -0
- package/dist/assertion/impl/async-iterable.cjs +627 -0
- package/dist/assertion/impl/async-iterable.cjs.map +1 -0
- package/dist/assertion/impl/async-iterable.d.cts +406 -0
- package/dist/assertion/impl/async-iterable.d.cts.map +1 -0
- package/dist/assertion/impl/async-iterable.d.ts +406 -0
- package/dist/assertion/impl/async-iterable.d.ts.map +1 -0
- package/dist/assertion/impl/async-iterable.js +624 -0
- package/dist/assertion/impl/async-iterable.js.map +1 -0
- package/dist/assertion/impl/async-parametric.cjs +412 -0
- package/dist/assertion/impl/async-parametric.cjs.map +1 -0
- package/dist/assertion/impl/async-parametric.d.cts +278 -0
- package/dist/assertion/impl/async-parametric.d.cts.map +1 -0
- package/dist/assertion/impl/async-parametric.d.ts +278 -0
- package/dist/assertion/impl/async-parametric.d.ts.map +1 -0
- package/dist/assertion/impl/async-parametric.js +409 -0
- package/dist/assertion/impl/async-parametric.js.map +1 -0
- package/dist/assertion/impl/async.cjs +56 -0
- package/dist/assertion/impl/async.cjs.map +1 -0
- package/dist/assertion/impl/async.d.cts +179 -0
- package/dist/assertion/impl/async.d.cts.map +1 -0
- package/dist/assertion/impl/async.d.ts +179 -0
- package/dist/assertion/impl/async.d.ts.map +1 -0
- package/dist/assertion/impl/async.js +39 -0
- package/dist/assertion/impl/async.js.map +1 -0
- package/dist/assertion/impl/index.cjs +37 -0
- package/dist/assertion/impl/index.cjs.map +1 -0
- package/dist/assertion/impl/index.d.cts +21 -0
- package/dist/assertion/impl/index.d.cts.map +1 -0
- package/dist/assertion/impl/index.d.ts +21 -0
- package/dist/assertion/impl/index.d.ts.map +1 -0
- package/dist/assertion/impl/index.js +21 -0
- package/dist/assertion/impl/index.js.map +1 -0
- package/dist/assertion/impl/iteration-util.cjs +297 -0
- package/dist/assertion/impl/iteration-util.cjs.map +1 -0
- package/dist/assertion/impl/iteration-util.d.cts +12 -0
- package/dist/assertion/impl/iteration-util.d.cts.map +1 -0
- package/dist/assertion/impl/iteration-util.d.ts +12 -0
- package/dist/assertion/impl/iteration-util.d.ts.map +1 -0
- package/dist/assertion/impl/iteration-util.js +282 -0
- package/dist/assertion/impl/iteration-util.js.map +1 -0
- package/dist/assertion/impl/snapshot.cjs +276 -0
- package/dist/assertion/impl/snapshot.cjs.map +1 -0
- package/dist/assertion/impl/snapshot.d.cts +278 -0
- package/dist/assertion/impl/snapshot.d.cts.map +1 -0
- package/dist/assertion/impl/snapshot.d.ts +278 -0
- package/dist/assertion/impl/snapshot.d.ts.map +1 -0
- package/dist/assertion/impl/snapshot.js +273 -0
- package/dist/assertion/impl/snapshot.js.map +1 -0
- package/dist/assertion/impl/sync-basic.cjs +553 -0
- package/dist/assertion/impl/sync-basic.cjs.map +1 -0
- package/dist/assertion/impl/sync-basic.d.cts +528 -0
- package/dist/assertion/impl/sync-basic.d.cts.map +1 -0
- package/dist/assertion/impl/sync-basic.d.ts +528 -0
- package/dist/assertion/impl/sync-basic.d.ts.map +1 -0
- package/dist/assertion/impl/sync-basic.js +550 -0
- package/dist/assertion/impl/sync-basic.js.map +1 -0
- package/dist/assertion/impl/sync-collection.cjs +1424 -0
- package/dist/assertion/impl/sync-collection.cjs.map +1 -0
- package/dist/assertion/impl/sync-collection.d.cts +922 -0
- package/dist/assertion/impl/sync-collection.d.cts.map +1 -0
- package/dist/assertion/impl/sync-collection.d.ts +922 -0
- package/dist/assertion/impl/sync-collection.d.ts.map +1 -0
- package/dist/assertion/impl/sync-collection.js +1418 -0
- package/dist/assertion/impl/sync-collection.js.map +1 -0
- package/dist/assertion/impl/sync-date.cjs +341 -0
- package/dist/assertion/impl/sync-date.cjs.map +1 -0
- package/dist/assertion/impl/sync-date.d.cts +209 -0
- package/dist/assertion/impl/sync-date.d.cts.map +1 -0
- package/dist/assertion/impl/sync-date.d.ts +209 -0
- package/dist/assertion/impl/sync-date.d.ts.map +1 -0
- package/dist/assertion/impl/sync-date.js +338 -0
- package/dist/assertion/impl/sync-date.js.map +1 -0
- package/dist/assertion/impl/sync-esoteric.cjs +214 -0
- package/dist/assertion/impl/sync-esoteric.cjs.map +1 -0
- package/dist/assertion/impl/sync-esoteric.d.cts +191 -0
- package/dist/assertion/impl/sync-esoteric.d.cts.map +1 -0
- package/dist/assertion/impl/sync-esoteric.d.ts +191 -0
- package/dist/assertion/impl/sync-esoteric.d.ts.map +1 -0
- package/dist/assertion/impl/sync-esoteric.js +211 -0
- package/dist/assertion/impl/sync-esoteric.js.map +1 -0
- package/dist/assertion/impl/sync-iterable.cjs +512 -0
- package/dist/assertion/impl/sync-iterable.cjs.map +1 -0
- package/dist/assertion/impl/sync-iterable.d.cts +334 -0
- package/dist/assertion/impl/sync-iterable.d.cts.map +1 -0
- package/dist/assertion/impl/sync-iterable.d.ts +334 -0
- package/dist/assertion/impl/sync-iterable.d.ts.map +1 -0
- package/dist/assertion/impl/sync-iterable.js +509 -0
- package/dist/assertion/impl/sync-iterable.js.map +1 -0
- package/dist/assertion/impl/sync-parametric.cjs +805 -0
- package/dist/assertion/impl/sync-parametric.cjs.map +1 -0
- package/dist/assertion/impl/sync-parametric.d.cts +560 -0
- package/dist/assertion/impl/sync-parametric.d.cts.map +1 -0
- package/dist/assertion/impl/sync-parametric.d.ts +560 -0
- package/dist/assertion/impl/sync-parametric.d.ts.map +1 -0
- package/dist/assertion/impl/sync-parametric.js +802 -0
- package/dist/assertion/impl/sync-parametric.js.map +1 -0
- package/dist/assertion/impl/sync.cjs +229 -0
- package/dist/assertion/impl/sync.cjs.map +1 -0
- package/dist/assertion/impl/sync.d.cts +536 -0
- package/dist/assertion/impl/sync.d.cts.map +1 -0
- package/dist/assertion/impl/sync.d.ts +536 -0
- package/dist/assertion/impl/sync.d.ts.map +1 -0
- package/dist/assertion/impl/sync.js +212 -0
- package/dist/assertion/impl/sync.js.map +1 -0
- package/dist/assertion/index.cjs +38 -0
- package/dist/assertion/index.cjs.map +1 -0
- package/dist/assertion/index.d.cts +18 -0
- package/dist/assertion/index.d.cts.map +1 -0
- package/dist/assertion/index.d.ts +18 -0
- package/dist/assertion/index.d.ts.map +1 -0
- package/dist/assertion/index.js +17 -0
- package/dist/assertion/index.js.map +1 -0
- package/dist/assertion/slotify.cjs +165 -0
- package/dist/assertion/slotify.cjs.map +1 -0
- package/dist/assertion/slotify.d.cts +11 -0
- package/dist/assertion/slotify.d.cts.map +1 -0
- package/dist/assertion/slotify.d.ts +11 -0
- package/dist/assertion/slotify.d.ts.map +1 -0
- package/dist/assertion/slotify.js +161 -0
- package/dist/assertion/slotify.js.map +1 -0
- package/dist/bootstrap.cjs +43 -0
- package/dist/bootstrap.cjs.map +1 -0
- package/dist/bootstrap.d.cts +27 -0
- package/dist/bootstrap.d.cts.map +1 -0
- package/dist/bootstrap.d.ts +27 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +40 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/constant.cjs +82 -0
- package/dist/constant.cjs.map +1 -0
- package/dist/constant.d.cts +69 -0
- package/dist/constant.d.cts.map +1 -0
- package/dist/constant.d.ts +69 -0
- package/dist/constant.d.ts.map +1 -0
- package/dist/constant.js +79 -0
- package/dist/constant.js.map +1 -0
- package/dist/diff.cjs +340 -0
- package/dist/diff.cjs.map +1 -0
- package/dist/diff.d.cts +51 -0
- package/dist/diff.d.cts.map +1 -0
- package/dist/diff.d.ts +51 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +334 -0
- package/dist/diff.js.map +1 -0
- package/dist/error.cjs +194 -0
- package/dist/error.cjs.map +1 -0
- package/dist/error.d.cts +212 -0
- package/dist/error.d.cts.map +1 -0
- package/dist/error.d.ts +212 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +181 -0
- package/dist/error.js.map +1 -0
- package/dist/expect.cjs +587 -0
- package/dist/expect.cjs.map +1 -0
- package/dist/expect.d.cts +138 -0
- package/dist/expect.d.cts.map +1 -0
- package/dist/expect.d.ts +138 -0
- package/dist/expect.d.ts.map +1 -0
- package/dist/expect.js +582 -0
- package/dist/expect.js.map +1 -0
- package/dist/guards.cjs +291 -0
- package/dist/guards.cjs.map +1 -0
- package/dist/guards.d.cts +225 -0
- package/dist/guards.d.cts.map +1 -0
- package/dist/guards.d.ts +225 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/guards.js +273 -0
- package/dist/guards.js.map +1 -0
- package/dist/index.cjs +111 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +460 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +460 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/internal-schema.cjs +234 -0
- package/dist/internal-schema.cjs.map +1 -0
- package/dist/internal-schema.d.cts +8 -0
- package/dist/internal-schema.d.cts.map +1 -0
- package/dist/internal-schema.d.ts +8 -0
- package/dist/internal-schema.d.ts.map +1 -0
- package/dist/internal-schema.js +229 -0
- package/dist/internal-schema.js.map +1 -0
- package/dist/metadata.cjs +57 -0
- package/dist/metadata.cjs.map +1 -0
- package/dist/metadata.d.cts +27 -0
- package/dist/metadata.d.cts.map +1 -0
- package/dist/metadata.d.ts +27 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +54 -0
- package/dist/metadata.js.map +1 -0
- package/dist/schema.cjs +1522 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +1196 -0
- package/dist/schema.d.cts.map +1 -0
- package/dist/schema.d.ts +1196 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +1516 -0
- package/dist/schema.js.map +1 -0
- package/dist/snapshot/adapter.cjs +29 -0
- package/dist/snapshot/adapter.cjs.map +1 -0
- package/dist/snapshot/adapter.d.cts +258 -0
- package/dist/snapshot/adapter.d.cts.map +1 -0
- package/dist/snapshot/adapter.d.ts +258 -0
- package/dist/snapshot/adapter.d.ts.map +1 -0
- package/dist/snapshot/adapter.js +25 -0
- package/dist/snapshot/adapter.js.map +1 -0
- package/dist/snapshot/adapters/fallback.cjs +452 -0
- package/dist/snapshot/adapters/fallback.cjs.map +1 -0
- package/dist/snapshot/adapters/fallback.d.cts +185 -0
- package/dist/snapshot/adapters/fallback.d.cts.map +1 -0
- package/dist/snapshot/adapters/fallback.d.ts +185 -0
- package/dist/snapshot/adapters/fallback.d.ts.map +1 -0
- package/dist/snapshot/adapters/fallback.js +445 -0
- package/dist/snapshot/adapters/fallback.js.map +1 -0
- package/dist/snapshot/adapters/node-test.cjs +297 -0
- package/dist/snapshot/adapters/node-test.cjs.map +1 -0
- package/dist/snapshot/adapters/node-test.d.cts +131 -0
- package/dist/snapshot/adapters/node-test.d.cts.map +1 -0
- package/dist/snapshot/adapters/node-test.d.ts +131 -0
- package/dist/snapshot/adapters/node-test.d.ts.map +1 -0
- package/dist/snapshot/adapters/node-test.js +293 -0
- package/dist/snapshot/adapters/node-test.js.map +1 -0
- package/dist/snapshot/index.cjs +61 -0
- package/dist/snapshot/index.cjs.map +1 -0
- package/dist/snapshot/index.d.cts +40 -0
- package/dist/snapshot/index.d.cts.map +1 -0
- package/dist/snapshot/index.d.ts +40 -0
- package/dist/snapshot/index.d.ts.map +1 -0
- package/dist/snapshot/index.js +44 -0
- package/dist/snapshot/index.js.map +1 -0
- package/dist/snapshot/node-version.cjs +49 -0
- package/dist/snapshot/node-version.cjs.map +1 -0
- package/dist/snapshot/node-version.d.cts +34 -0
- package/dist/snapshot/node-version.d.cts.map +1 -0
- package/dist/snapshot/node-version.d.ts +34 -0
- package/dist/snapshot/node-version.d.ts.map +1 -0
- package/dist/snapshot/node-version.js +44 -0
- package/dist/snapshot/node-version.js.map +1 -0
- package/dist/snapshot/select-adapter.cjs +170 -0
- package/dist/snapshot/select-adapter.cjs.map +1 -0
- package/dist/snapshot/select-adapter.d.cts +128 -0
- package/dist/snapshot/select-adapter.d.cts.map +1 -0
- package/dist/snapshot/select-adapter.d.ts +128 -0
- package/dist/snapshot/select-adapter.d.ts.map +1 -0
- package/dist/snapshot/select-adapter.js +164 -0
- package/dist/snapshot/select-adapter.js.map +1 -0
- package/dist/snapshot/serializer.cjs +245 -0
- package/dist/snapshot/serializer.cjs.map +1 -0
- package/dist/snapshot/serializer.d.cts +126 -0
- package/dist/snapshot/serializer.d.cts.map +1 -0
- package/dist/snapshot/serializer.d.ts +126 -0
- package/dist/snapshot/serializer.d.ts.map +1 -0
- package/dist/snapshot/serializer.js +237 -0
- package/dist/snapshot/serializer.js.map +1 -0
- package/dist/standard-schema.cjs +13 -0
- package/dist/standard-schema.cjs.map +1 -0
- package/dist/standard-schema.d.cts +192 -0
- package/dist/standard-schema.d.cts.map +1 -0
- package/dist/standard-schema.d.ts +192 -0
- package/dist/standard-schema.d.ts.map +1 -0
- package/dist/standard-schema.js +12 -0
- package/dist/standard-schema.js.map +1 -0
- package/dist/types.cjs +22 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +756 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +756 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/dist/use.cjs +240 -0
- package/dist/use.cjs.map +1 -0
- package/dist/use.d.cts +8 -0
- package/dist/use.d.cts.map +1 -0
- package/dist/use.d.ts +8 -0
- package/dist/use.d.ts.map +1 -0
- package/dist/use.js +236 -0
- package/dist/use.js.map +1 -0
- package/dist/util.cjs +255 -0
- package/dist/util.cjs.map +1 -0
- package/dist/util.d.cts +141 -0
- package/dist/util.d.cts.map +1 -0
- package/dist/util.d.ts +141 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +234 -0
- package/dist/util.js.map +1 -0
- package/dist/value-to-schema.cjs +537 -0
- package/dist/value-to-schema.cjs.map +1 -0
- package/dist/value-to-schema.d.cts +144 -0
- package/dist/value-to-schema.d.cts.map +1 -0
- package/dist/value-to-schema.d.ts +144 -0
- package/dist/value-to-schema.d.ts.map +1 -0
- package/dist/value-to-schema.js +533 -0
- package/dist/value-to-schema.js.map +1 -0
- package/package.json +24 -21
- package/src/assertion/assertion-sync.ts +1 -1
- package/src/assertion/assertion-types.ts +4 -8
- package/src/assertion/assertion.ts +12 -7
- package/src/assertion/format-assertion-failure.ts +2 -0
- package/src/assertion/impl/assertion-util.ts +1 -2
- package/src/assertion/impl/iteration-util.ts +3 -5
- package/src/assertion/impl/sync-collection.ts +633 -7
- package/src/assertion/impl/sync.ts +27 -0
- package/src/error.ts +13 -22
- package/src/expect.ts +1 -1
- package/src/guards.ts +8 -14
- package/src/internal-schema.ts +4 -8
- package/src/metadata.ts +1 -2
- package/src/snapshot/adapter.ts +2 -3
- package/src/snapshot/adapters/fallback.ts +2 -3
- package/src/snapshot/adapters/node-test.ts +14 -20
- package/src/snapshot/select-adapter.ts +3 -3
- package/src/snapshot/serializer.ts +2 -3
- package/src/types.ts +2 -162
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic type and primitive value assertions.
|
|
3
|
+
*
|
|
4
|
+
* These are the fundamental building blocks for type checking including
|
|
5
|
+
* strings, numbers, booleans, arrays, objects, functions, and other primitive
|
|
6
|
+
* JavaScript types.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @groupDescription Basic Assertions
|
|
10
|
+
* Fundamental type checking and primitive value validation.
|
|
11
|
+
*
|
|
12
|
+
* @showGroups
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
import { BupkisRegistry } from "../../metadata.js";
|
|
16
|
+
import { ArrayLikeSchema, AsyncFunctionSchema, BigintSchema, BooleanSchema, ConstructibleSchema, DateSchema, ErrorSchema, FalsySchema, FunctionSchema, InfinitySchema, NegativeInfinitySchema, NegativeNumberSchema, NumberSchema, PositiveNumberSchema, PrimitiveSchema, SetSchema, StringSchema, SymbolSchema, TruthySchema, UnknownArraySchema, UnknownRecordSchema, UnknownSchema, WeakMapSchema, WeakSetSchema, } from "../../schema.js";
|
|
17
|
+
import { createAssertion } from "../create.js";
|
|
18
|
+
const { ownKeys } = Reflect;
|
|
19
|
+
/**
|
|
20
|
+
* Asserts that the subject is a string value.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* expect('hello', 'to be a string'); // passes
|
|
26
|
+
* expect(42, 'to be a string'); // fails
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @group Basic Assertions
|
|
30
|
+
* @bupkisAnchor unknown-to-be-a-string
|
|
31
|
+
* @bupkisAssertionCategory primitives
|
|
32
|
+
*/
|
|
33
|
+
export const stringAssertion = createAssertion(['to be a string'], StringSchema);
|
|
34
|
+
/**
|
|
35
|
+
* Asserts that the subject is a finite number value.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* expect(42, 'to be a number'); // passes
|
|
41
|
+
* expect(Infinity, 'to be a number'); // fails
|
|
42
|
+
* expect('42', 'to be a number'); // fails
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @group Basic Assertions
|
|
46
|
+
*/
|
|
47
|
+
export const numberAssertion = createAssertion([['to be a number', 'to be finite']], NumberSchema);
|
|
48
|
+
/**
|
|
49
|
+
* Asserts that the subject is either positive or negative infinity.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* expect(Infinity, 'to be infinite'); // passes
|
|
55
|
+
* expect(-Infinity, 'to be infinite'); // passes
|
|
56
|
+
* expect(42, 'to be infinite'); // fails
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @group Basic Assertions
|
|
60
|
+
*/
|
|
61
|
+
export const infiniteAssertion = createAssertion(['to be infinite'], InfinitySchema.or(NegativeInfinitySchema));
|
|
62
|
+
/**
|
|
63
|
+
* Asserts that the subject is positive infinity.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
*
|
|
67
|
+
* ```ts
|
|
68
|
+
* expect(Infinity, 'to be Infinity'); // passes
|
|
69
|
+
* expect(-Infinity, 'to be Infinity'); // fails
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @group Basic Assertions
|
|
73
|
+
*/
|
|
74
|
+
export const positiveInfinityAssertion = createAssertion(['to be Infinity'], InfinitySchema);
|
|
75
|
+
/**
|
|
76
|
+
* Asserts that the subject is negative infinity.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
*
|
|
80
|
+
* ```ts
|
|
81
|
+
* expect(-Infinity, 'to be -Infinity'); // passes
|
|
82
|
+
* expect(Infinity, 'to be -Infinity'); // fails
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @group Basic Assertions
|
|
86
|
+
*/
|
|
87
|
+
export const negativeInfinityAssertion = createAssertion(['to be -Infinity'], NegativeInfinitySchema);
|
|
88
|
+
/**
|
|
89
|
+
* Asserts that the subject is a boolean value.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* expect(true, 'to be a boolean'); // passes
|
|
95
|
+
* expect('true', 'to be a boolean'); // fails
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @group Basic Assertions
|
|
99
|
+
*/
|
|
100
|
+
export const booleanAssertion = createAssertion([['to be a boolean', 'to be boolean', 'to be a bool']], BooleanSchema);
|
|
101
|
+
/**
|
|
102
|
+
* Asserts that the subject is a positive number.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
*
|
|
106
|
+
* ```ts
|
|
107
|
+
* expect(42, 'to be positive'); // passes
|
|
108
|
+
* expect(-1, 'to be positive'); // fails
|
|
109
|
+
* expect(0, 'to be positive'); // fails
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @group Basic Assertions
|
|
113
|
+
*/
|
|
114
|
+
export const positiveAssertion = createAssertion([['to be positive', 'to be a positive number']], PositiveNumberSchema);
|
|
115
|
+
/**
|
|
116
|
+
* Asserts that the subject is a positive integer.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
*
|
|
120
|
+
* ```ts
|
|
121
|
+
* expect(42, 'to be a positive integer'); // passes
|
|
122
|
+
* expect(-1, 'to be a positive integer'); // fails
|
|
123
|
+
* expect(42.5, 'to be a positive integer'); // fails
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @group Basic Assertions
|
|
127
|
+
*/
|
|
128
|
+
export const positiveIntegerAssertion = createAssertion([['to be a positive integer', 'to be a positive int']], PositiveNumberSchema.int());
|
|
129
|
+
/**
|
|
130
|
+
* Asserts that the subject is a negative number.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
*
|
|
134
|
+
* ```ts
|
|
135
|
+
* expect(-42, 'to be negative'); // passes
|
|
136
|
+
* expect(1, 'to be negative'); // fails
|
|
137
|
+
* expect(0, 'to be negative'); // fails
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @group Basic Assertions
|
|
141
|
+
*/
|
|
142
|
+
export const negativeAssertion = createAssertion([['to be negative', 'to be a negative number']], NegativeNumberSchema);
|
|
143
|
+
/**
|
|
144
|
+
* Asserts that the subject is a negative integer.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
*
|
|
148
|
+
* ```ts
|
|
149
|
+
* expect(-42, 'to be a negative integer'); // passes
|
|
150
|
+
* expect(1, 'to be a negative integer'); // fails
|
|
151
|
+
* expect(-42.5, 'to be a negative integer'); // fails
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @group Basic Assertions
|
|
155
|
+
*/
|
|
156
|
+
export const negativeIntegerAssertion = createAssertion([['to be a negative integer', 'to be a negative int']], NegativeNumberSchema.int());
|
|
157
|
+
/**
|
|
158
|
+
* Asserts that the subject is exactly the boolean value true.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
*
|
|
162
|
+
* ```ts
|
|
163
|
+
* expect(true, 'to be true'); // passes
|
|
164
|
+
* expect(false, 'to be true'); // fails
|
|
165
|
+
* expect(1, 'to be true'); // fails
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @group Basic Assertions
|
|
169
|
+
*/
|
|
170
|
+
export const trueAssertion = createAssertion(['to be true'], z.literal(true));
|
|
171
|
+
/**
|
|
172
|
+
* Asserts that the subject is exactly the boolean value false.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
*
|
|
176
|
+
* ```ts
|
|
177
|
+
* expect(false, 'to be false'); // passes
|
|
178
|
+
* expect(true, 'to be false'); // fails
|
|
179
|
+
* expect(0, 'to be false'); // fails
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* @group Basic Assertions
|
|
183
|
+
*/
|
|
184
|
+
export const falseAssertion = createAssertion(['to be false'], z.literal(false));
|
|
185
|
+
/**
|
|
186
|
+
* Asserts that the subject is a BigInt value.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
*
|
|
190
|
+
* ```ts
|
|
191
|
+
* expect(123n, 'to be a bigint'); // passes
|
|
192
|
+
* expect(123, 'to be a bigint'); // fails
|
|
193
|
+
* ```
|
|
194
|
+
*
|
|
195
|
+
* @group Basic Assertions
|
|
196
|
+
*/
|
|
197
|
+
export const bigintAssertion = createAssertion([['to be a bigint', 'to be a BigInt']], BigintSchema);
|
|
198
|
+
/**
|
|
199
|
+
* Asserts that the subject is a Symbol.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
*
|
|
203
|
+
* ```ts
|
|
204
|
+
* expect(Symbol('test'), 'to be a symbol'); // passes
|
|
205
|
+
* expect('symbol', 'to be a symbol'); // fails
|
|
206
|
+
* ```
|
|
207
|
+
*
|
|
208
|
+
* @group Basic Assertions
|
|
209
|
+
*/
|
|
210
|
+
export const symbolAssertion = createAssertion([['to be a symbol', 'to be a Symbol']], SymbolSchema);
|
|
211
|
+
/**
|
|
212
|
+
* Asserts that the subject is a function.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
*
|
|
216
|
+
* ```ts
|
|
217
|
+
* expect(() => {}, 'to be a function'); // passes
|
|
218
|
+
* expect('function', 'to be a function'); // fails
|
|
219
|
+
* ```
|
|
220
|
+
*
|
|
221
|
+
* @group Basic Assertions
|
|
222
|
+
*/
|
|
223
|
+
export const functionAssertion = createAssertion(['to be a function'], FunctionSchema);
|
|
224
|
+
/**
|
|
225
|
+
* Asserts that the subject is an async function.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
*
|
|
229
|
+
* ```ts
|
|
230
|
+
* expect(async () => {}, 'to be an async function'); // passes
|
|
231
|
+
* expect(() => {}, 'to be an async function'); // fails
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* @group Basic Assertions
|
|
235
|
+
*/
|
|
236
|
+
export const asyncFunctionAssertion = createAssertion(['to be an async function'], AsyncFunctionSchema);
|
|
237
|
+
/**
|
|
238
|
+
* Asserts that the subject is NaN (Not a Number).
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
*
|
|
242
|
+
* ```ts
|
|
243
|
+
* expect(NaN, 'to be NaN'); // passes
|
|
244
|
+
* expect(42, 'to be NaN'); // fails
|
|
245
|
+
* expect('not a number', 'to be NaN'); // fails
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
248
|
+
* @group Basic Assertions
|
|
249
|
+
*/
|
|
250
|
+
export const nanAssertion = createAssertion(['to be NaN'], z.nan());
|
|
251
|
+
/**
|
|
252
|
+
* Asserts that the subject is an integer (safe integer).
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
*
|
|
256
|
+
* ```ts
|
|
257
|
+
* expect(42, 'to be an integer'); // passes
|
|
258
|
+
* expect(42.5, 'to be an integer'); // fails
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* @group Basic Assertions
|
|
262
|
+
*/
|
|
263
|
+
export const integerAssertion = createAssertion([
|
|
264
|
+
[
|
|
265
|
+
'to be an integer',
|
|
266
|
+
'to be a safe integer',
|
|
267
|
+
'to be an int',
|
|
268
|
+
'to be a safe int',
|
|
269
|
+
],
|
|
270
|
+
], NumberSchema.int());
|
|
271
|
+
/**
|
|
272
|
+
* Asserts that the subject is null.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
*
|
|
276
|
+
* ```ts
|
|
277
|
+
* expect(null, 'to be null'); // passes
|
|
278
|
+
* expect(undefined, 'to be null'); // fails
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* @group Basic Assertions
|
|
282
|
+
*/
|
|
283
|
+
export const nullAssertion = createAssertion(['to be null'], z.null());
|
|
284
|
+
/**
|
|
285
|
+
* Asserts that the subject is undefined.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
*
|
|
289
|
+
* ```ts
|
|
290
|
+
* expect(undefined, 'to be undefined'); // passes
|
|
291
|
+
* expect(null, 'to be undefined'); // fails
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @group Basic Assertions
|
|
295
|
+
*/
|
|
296
|
+
export const undefinedAssertion = createAssertion(['to be undefined'], z.undefined());
|
|
297
|
+
/**
|
|
298
|
+
* Asserts that the subject is an array.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
*
|
|
302
|
+
* ```ts
|
|
303
|
+
* expect([1, 2, 3], 'to be an array'); // passes
|
|
304
|
+
* expect('array', 'to be an array'); // fails
|
|
305
|
+
* ```
|
|
306
|
+
*
|
|
307
|
+
* @group Basic Assertions
|
|
308
|
+
*/
|
|
309
|
+
export const arrayAssertion = createAssertion([['to be an array', 'to be array']], UnknownArraySchema);
|
|
310
|
+
/**
|
|
311
|
+
* Asserts that the subject is a Date object.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
*
|
|
315
|
+
* ```ts
|
|
316
|
+
* expect(new Date(), 'to be a date'); // passes
|
|
317
|
+
* expect('2023-01-01', 'to be a date'); // fails
|
|
318
|
+
* ```
|
|
319
|
+
*
|
|
320
|
+
* @group Basic Assertions
|
|
321
|
+
*/
|
|
322
|
+
export const dateAssertion = createAssertion([['to be a date', 'to be a Date']], DateSchema);
|
|
323
|
+
/**
|
|
324
|
+
* Asserts that the subject is a class constructor (constructible function).
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
*
|
|
328
|
+
* ```ts
|
|
329
|
+
* expect(Date, 'to be a class'); // passes
|
|
330
|
+
* expect(() => {}, 'to be a class'); // fails
|
|
331
|
+
* ```
|
|
332
|
+
*
|
|
333
|
+
* @group Basic Assertions
|
|
334
|
+
*/
|
|
335
|
+
export const classAssertion = createAssertion([['to be a class', 'to be a constructor', 'to be constructible']], ConstructibleSchema);
|
|
336
|
+
/**
|
|
337
|
+
* Asserts that the subject is a primitive value (string, number, boolean, null,
|
|
338
|
+
* undefined, symbol, or bigint).
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
*
|
|
342
|
+
* ```ts
|
|
343
|
+
* expect('hello', 'to be a primitive'); // passes
|
|
344
|
+
* expect({}, 'to be a primitive'); // fails
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* @group Basic Assertions
|
|
348
|
+
*/
|
|
349
|
+
export const primitiveAssertion = createAssertion(['to be a primitive'], PrimitiveSchema);
|
|
350
|
+
/**
|
|
351
|
+
* Asserts that the subject is a regular expression.
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
*
|
|
355
|
+
* ```ts
|
|
356
|
+
* expect(/test/, 'to be a RegExp'); // passes
|
|
357
|
+
* expect('test', 'to be a RegExp'); // fails
|
|
358
|
+
* ```
|
|
359
|
+
*
|
|
360
|
+
* @group Basic Assertions
|
|
361
|
+
*/
|
|
362
|
+
export const regexpAssertion = createAssertion([['to be a RegExp', 'to be a regex', 'to be a regexp']], z.instanceof(RegExp));
|
|
363
|
+
/**
|
|
364
|
+
* Asserts that the subject is truthy (not false, 0, '', null, undefined, or
|
|
365
|
+
* NaN).
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
*
|
|
369
|
+
* ```ts
|
|
370
|
+
* expect('hello', 'to be truthy'); // passes
|
|
371
|
+
* expect('', 'to be truthy'); // fails
|
|
372
|
+
* ```
|
|
373
|
+
*
|
|
374
|
+
* @group Basic Assertions
|
|
375
|
+
*/
|
|
376
|
+
export const truthyAssertion = createAssertion([['to be truthy', 'to exist', 'to be ok']], TruthySchema);
|
|
377
|
+
/**
|
|
378
|
+
* Asserts that the subject is falsy (false, 0, '', null, undefined, or NaN).
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
*
|
|
382
|
+
* ```ts
|
|
383
|
+
* expect('', 'to be falsy'); // passes
|
|
384
|
+
* expect('hello', 'to be falsy'); // fails
|
|
385
|
+
* ```
|
|
386
|
+
*
|
|
387
|
+
* @group Basic Assertions
|
|
388
|
+
*/
|
|
389
|
+
export const falsyAssertion = createAssertion(['to be falsy'], FalsySchema);
|
|
390
|
+
/**
|
|
391
|
+
* Asserts that the subject is an object (non-null object type).
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
*
|
|
395
|
+
* ```ts
|
|
396
|
+
* expect({}, 'to be an object'); // passes
|
|
397
|
+
* expect(null, 'to be an object'); // fails
|
|
398
|
+
* expect('string', 'to be an object'); // fails
|
|
399
|
+
* ```
|
|
400
|
+
*
|
|
401
|
+
* @group Basic Assertions
|
|
402
|
+
*/
|
|
403
|
+
export const objectAssertion = createAssertion(['to be an object'], z
|
|
404
|
+
.unknown()
|
|
405
|
+
.nonoptional()
|
|
406
|
+
.refine((value) => typeof value == 'object' && value !== null)
|
|
407
|
+
.register(BupkisRegistry, { name: 'Object' })
|
|
408
|
+
.meta({
|
|
409
|
+
description: 'Returns true for any non-null value where `typeof value` is `object`',
|
|
410
|
+
}));
|
|
411
|
+
/**
|
|
412
|
+
* Asserts that the subject is a record (plain object with string/symbol/number
|
|
413
|
+
* keys).
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
*
|
|
417
|
+
* ```ts
|
|
418
|
+
* expect({ key: 'value' }, 'to be a record'); // passes
|
|
419
|
+
* expect([], 'to be a record'); // fails
|
|
420
|
+
* ```
|
|
421
|
+
*
|
|
422
|
+
* @group Basic Assertions
|
|
423
|
+
*/
|
|
424
|
+
export const recordAssertion = createAssertion([['to be a record', 'to be a plain object']], UnknownRecordSchema);
|
|
425
|
+
/**
|
|
426
|
+
* Asserts that an array is empty.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
*
|
|
430
|
+
* ```ts
|
|
431
|
+
* expect([], 'to be empty'); // passes
|
|
432
|
+
* expect([1, 2], 'to be empty'); // fails
|
|
433
|
+
* ```
|
|
434
|
+
*
|
|
435
|
+
* @group Basic Assertions
|
|
436
|
+
*/
|
|
437
|
+
export const emptyArrayAssertion = createAssertion([ArrayLikeSchema, 'to be empty'], (subject) => {
|
|
438
|
+
if (subject.length !== 0) {
|
|
439
|
+
return {
|
|
440
|
+
actual: subject.length,
|
|
441
|
+
expected: 0,
|
|
442
|
+
message: `Expected array-like to have length 0, but had length ${subject.length}`,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
/**
|
|
447
|
+
* Asserts that an object is empty (has no own properties).
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
*
|
|
451
|
+
* ```ts
|
|
452
|
+
* expect({}, 'to be empty'); // passes
|
|
453
|
+
* expect({ key: 'value' }, 'to be empty'); // fails
|
|
454
|
+
* ```
|
|
455
|
+
*
|
|
456
|
+
* @group Basic Assertions
|
|
457
|
+
*/
|
|
458
|
+
export const emptyObjectAssertion = createAssertion([UnknownRecordSchema, 'to be empty'], UnknownRecordSchema.refine((obj) => ownKeys(obj).length === 0));
|
|
459
|
+
/**
|
|
460
|
+
* Asserts that the subject is an Error instance.
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
*
|
|
464
|
+
* ```ts
|
|
465
|
+
* expect(new Error('test'), 'to be an Error'); // passes
|
|
466
|
+
* expect('error', 'to be an Error'); // fails
|
|
467
|
+
* ```
|
|
468
|
+
*
|
|
469
|
+
* @group Basic Assertions
|
|
470
|
+
*/
|
|
471
|
+
export const errorAssertion = createAssertion([['to be an Error', 'to be a Error']], ErrorSchema);
|
|
472
|
+
/**
|
|
473
|
+
* Asserts that a string is empty.
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
*
|
|
477
|
+
* ```ts
|
|
478
|
+
* expect('', 'to be empty'); // passes
|
|
479
|
+
* expect('hello', 'to be empty'); // fails
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* @group Basic Assertions
|
|
483
|
+
*/
|
|
484
|
+
export const emptyStringAssertion = createAssertion([StringSchema, 'to be empty'], StringSchema.max(0));
|
|
485
|
+
/**
|
|
486
|
+
* Asserts that a string is non-empty.
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
*
|
|
490
|
+
* ```ts
|
|
491
|
+
* expect('hello', 'to be non-empty'); // passes
|
|
492
|
+
* expect('', 'to be non-empty'); // fails
|
|
493
|
+
* ```
|
|
494
|
+
*
|
|
495
|
+
* @group Basic Assertions
|
|
496
|
+
*/
|
|
497
|
+
export const nonEmptyStringAssertion = createAssertion([StringSchema, 'to be non-empty'], StringSchema.min(1));
|
|
498
|
+
/**
|
|
499
|
+
* Asserts that the subject is defined (not undefined).
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
*
|
|
503
|
+
* ```ts
|
|
504
|
+
* expect(null, 'to be defined'); // passes
|
|
505
|
+
* expect(undefined, 'to be defined'); // fails
|
|
506
|
+
* ```
|
|
507
|
+
*
|
|
508
|
+
* @group Basic Assertions
|
|
509
|
+
*/
|
|
510
|
+
export const definedAssertion = createAssertion(['to be defined'], UnknownSchema.nonoptional());
|
|
511
|
+
/**
|
|
512
|
+
* Asserts that the subject is a Set instance.
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
*
|
|
516
|
+
* ```ts
|
|
517
|
+
* expect(new Set(), 'to be a Set'); // passes
|
|
518
|
+
* expect([], 'to be a Set'); // fails
|
|
519
|
+
* ```
|
|
520
|
+
*
|
|
521
|
+
* @group Basic Assertions
|
|
522
|
+
*/
|
|
523
|
+
export const setAssertion = createAssertion(['to be a Set'], SetSchema);
|
|
524
|
+
/**
|
|
525
|
+
* Asserts that the subject is a WeakMap instance.
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
*
|
|
529
|
+
* ```ts
|
|
530
|
+
* expect(new WeakMap(), 'to be a WeakMap'); // passes
|
|
531
|
+
* expect(new Map(), 'to be a WeakMap'); // fails
|
|
532
|
+
* ```
|
|
533
|
+
*
|
|
534
|
+
* @group Basic Assertions
|
|
535
|
+
*/
|
|
536
|
+
export const weakMapAssertion = createAssertion(['to be a WeakMap'], WeakMapSchema);
|
|
537
|
+
/**
|
|
538
|
+
* Asserts that the subject is a WeakSet instance.
|
|
539
|
+
*
|
|
540
|
+
* @example
|
|
541
|
+
*
|
|
542
|
+
* ```ts
|
|
543
|
+
* expect(new WeakSet(), 'to be a WeakSet'); // passes
|
|
544
|
+
* expect(new Set(), 'to be a WeakSet'); // fails
|
|
545
|
+
* ```
|
|
546
|
+
*
|
|
547
|
+
* @group Basic Assertions
|
|
548
|
+
*/
|
|
549
|
+
export const weakSetAssertion = createAssertion(['to be a WeakSet'], WeakSetSchema);
|
|
550
|
+
//# sourceMappingURL=sync-basic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-basic.js","sourceRoot":"","sources":["../../../src/assertion/impl/sync-basic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,0BAA0B;AACnD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,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