hein 2.0.0-alpha.2 → 2.0.0-alpha.3
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/dist/_virtual/rolldown_runtime.cjs +34 -0
- package/dist/assert/deep-equal.cjs +40 -0
- package/dist/assert/deep-equal.cjs.map +1 -0
- package/dist/assert/deep-equal.d.cts +5 -0
- package/dist/assert/deep-equal.d.cts.map +1 -0
- package/dist/assert/deep-equal.d.ts +5 -0
- package/dist/assert/deep-equal.d.ts.map +1 -0
- package/dist/assert/deep-equal.js +36 -0
- package/dist/assert/deep-equal.js.map +1 -0
- package/dist/assert/deep-has-property.cjs +68 -0
- package/dist/assert/deep-has-property.cjs.map +1 -0
- package/dist/assert/deep-has-property.d.cts +22 -0
- package/dist/assert/deep-has-property.d.cts.map +1 -0
- package/dist/assert/deep-has-property.d.ts +22 -0
- package/dist/assert/deep-has-property.d.ts.map +1 -0
- package/dist/assert/deep-has-property.js +63 -0
- package/dist/assert/deep-has-property.js.map +1 -0
- package/dist/assert/ends-with.cjs +30 -0
- package/dist/assert/ends-with.cjs.map +1 -0
- package/dist/assert/ends-with.d.cts +13 -0
- package/dist/assert/ends-with.d.cts.map +1 -0
- package/dist/assert/ends-with.d.ts +13 -0
- package/dist/assert/ends-with.d.ts.map +1 -0
- package/dist/assert/ends-with.js +27 -0
- package/dist/assert/ends-with.js.map +1 -0
- package/dist/assert/equal.cjs +37 -0
- package/dist/assert/equal.cjs.map +1 -0
- package/dist/assert/equal.d.cts +11 -0
- package/dist/assert/equal.d.cts.map +1 -0
- package/dist/assert/equal.d.ts +11 -0
- package/dist/assert/equal.d.ts.map +1 -0
- package/dist/assert/equal.js +34 -0
- package/dist/assert/equal.js.map +1 -0
- package/dist/assert/greater-than-equal.cjs +32 -0
- package/dist/assert/greater-than-equal.cjs.map +1 -0
- package/dist/assert/greater-than-equal.d.cts +11 -0
- package/dist/assert/greater-than-equal.d.cts.map +1 -0
- package/dist/assert/greater-than-equal.d.ts +11 -0
- package/dist/assert/greater-than-equal.d.ts.map +1 -0
- package/dist/assert/greater-than-equal.js +29 -0
- package/dist/assert/greater-than-equal.js.map +1 -0
- package/dist/assert/greater-than.cjs +33 -0
- package/dist/assert/greater-than.cjs.map +1 -0
- package/dist/assert/greater-than.d.cts +11 -0
- package/dist/assert/greater-than.d.cts.map +1 -0
- package/dist/assert/greater-than.d.ts +11 -0
- package/dist/assert/greater-than.d.ts.map +1 -0
- package/dist/assert/greater-than.js +30 -0
- package/dist/assert/greater-than.js.map +1 -0
- package/dist/assert/has-keys.cjs +58 -0
- package/dist/assert/has-keys.cjs.map +1 -0
- package/dist/assert/has-keys.d.cts +16 -0
- package/dist/assert/has-keys.d.cts.map +1 -0
- package/dist/assert/has-keys.d.ts +16 -0
- package/dist/assert/has-keys.d.ts.map +1 -0
- package/dist/assert/has-keys.js +54 -0
- package/dist/assert/has-keys.js.map +1 -0
- package/dist/assert/has-members.cjs +67 -0
- package/dist/assert/has-members.cjs.map +1 -0
- package/dist/assert/has-members.d.cts +48 -0
- package/dist/assert/has-members.d.cts.map +1 -0
- package/dist/assert/has-members.d.ts +48 -0
- package/dist/assert/has-members.d.ts.map +1 -0
- package/dist/assert/has-members.js +64 -0
- package/dist/assert/has-members.js.map +1 -0
- package/dist/assert/has-property.cjs +61 -0
- package/dist/assert/has-property.cjs.map +1 -0
- package/dist/assert/has-property.d.cts +22 -0
- package/dist/assert/has-property.d.cts.map +1 -0
- package/dist/assert/has-property.d.ts +22 -0
- package/dist/assert/has-property.d.ts.map +1 -0
- package/dist/assert/has-property.js +58 -0
- package/dist/assert/has-property.js.map +1 -0
- package/dist/assert/has-size.cjs +122 -0
- package/dist/assert/has-size.cjs.map +1 -0
- package/dist/assert/has-size.d.cts +42 -0
- package/dist/assert/has-size.d.cts.map +1 -0
- package/dist/assert/has-size.d.ts +42 -0
- package/dist/assert/has-size.d.ts.map +1 -0
- package/dist/assert/has-size.js +118 -0
- package/dist/assert/has-size.js.map +1 -0
- package/dist/assert/in-ballpark.cjs +44 -0
- package/dist/assert/in-ballpark.cjs.map +1 -0
- package/dist/assert/in-ballpark.d.cts +16 -0
- package/dist/assert/in-ballpark.d.cts.map +1 -0
- package/dist/assert/in-ballpark.d.ts +16 -0
- package/dist/assert/in-ballpark.d.ts.map +1 -0
- package/dist/assert/in-ballpark.js +41 -0
- package/dist/assert/in-ballpark.js.map +1 -0
- package/dist/assert/includes.cjs +30 -0
- package/dist/assert/includes.cjs.map +1 -0
- package/dist/assert/includes.d.cts +24 -0
- package/dist/assert/includes.d.cts.map +1 -0
- package/dist/assert/includes.d.ts +24 -0
- package/dist/assert/includes.d.ts.map +1 -0
- package/dist/assert/includes.js +27 -0
- package/dist/assert/includes.js.map +1 -0
- package/dist/assert/instance-of.cjs +36 -0
- package/dist/assert/instance-of.cjs.map +1 -0
- package/dist/assert/instance-of.d.cts +16 -0
- package/dist/assert/instance-of.d.cts.map +1 -0
- package/dist/assert/instance-of.d.ts +16 -0
- package/dist/assert/instance-of.d.ts.map +1 -0
- package/dist/assert/instance-of.js +32 -0
- package/dist/assert/instance-of.js.map +1 -0
- package/dist/assert/is-after.cjs +29 -0
- package/dist/assert/is-after.cjs.map +1 -0
- package/dist/assert/is-after.d.cts +11 -0
- package/dist/assert/is-after.d.cts.map +1 -0
- package/dist/assert/is-after.d.ts +11 -0
- package/dist/assert/is-after.d.ts.map +1 -0
- package/dist/assert/is-after.js +26 -0
- package/dist/assert/is-after.js.map +1 -0
- package/dist/assert/is-before.cjs +29 -0
- package/dist/assert/is-before.cjs.map +1 -0
- package/dist/assert/is-before.d.cts +11 -0
- package/dist/assert/is-before.d.cts.map +1 -0
- package/dist/assert/is-before.d.ts +11 -0
- package/dist/assert/is-before.d.ts.map +1 -0
- package/dist/assert/is-before.js +26 -0
- package/dist/assert/is-before.js.map +1 -0
- package/dist/assert/is-between.cjs +47 -0
- package/dist/assert/is-between.cjs.map +1 -0
- package/dist/assert/is-between.d.cts +15 -0
- package/dist/assert/is-between.d.cts.map +1 -0
- package/dist/assert/is-between.d.ts +15 -0
- package/dist/assert/is-between.d.ts.map +1 -0
- package/dist/assert/is-between.js +44 -0
- package/dist/assert/is-between.js.map +1 -0
- package/dist/assert/is-empty.cjs +98 -0
- package/dist/assert/is-empty.cjs.map +1 -0
- package/dist/assert/is-empty.d.cts +31 -0
- package/dist/assert/is-empty.d.cts.map +1 -0
- package/dist/assert/is-empty.d.ts +31 -0
- package/dist/assert/is-empty.d.ts.map +1 -0
- package/dist/assert/is-empty.js +94 -0
- package/dist/assert/is-empty.js.map +1 -0
- package/dist/assert/is-type.cjs +34 -0
- package/dist/assert/is-type.cjs.map +1 -0
- package/dist/assert/is-type.d.cts +97 -0
- package/dist/assert/is-type.d.cts.map +1 -0
- package/dist/assert/is-type.d.ts +97 -0
- package/dist/assert/is-type.d.ts.map +1 -0
- package/dist/assert/is-type.js +31 -0
- package/dist/assert/is-type.js.map +1 -0
- package/dist/assert/less-than-equal.cjs +36 -0
- package/dist/assert/less-than-equal.cjs.map +1 -0
- package/dist/assert/less-than-equal.d.cts +11 -0
- package/dist/assert/less-than-equal.d.cts.map +1 -0
- package/dist/assert/less-than-equal.d.ts +11 -0
- package/dist/assert/less-than-equal.d.ts.map +1 -0
- package/dist/assert/less-than-equal.js +33 -0
- package/dist/assert/less-than-equal.js.map +1 -0
- package/dist/assert/less-than.cjs +34 -0
- package/dist/assert/less-than.cjs.map +1 -0
- package/dist/assert/less-than.d.cts +11 -0
- package/dist/assert/less-than.d.cts.map +1 -0
- package/dist/assert/less-than.d.ts +11 -0
- package/dist/assert/less-than.d.ts.map +1 -0
- package/dist/assert/less-than.js +31 -0
- package/dist/assert/less-than.js.map +1 -0
- package/dist/assert/match.cjs +31 -0
- package/dist/assert/match.cjs.map +1 -0
- package/dist/assert/match.d.cts +15 -0
- package/dist/assert/match.d.cts.map +1 -0
- package/dist/assert/match.d.ts +15 -0
- package/dist/assert/match.d.ts.map +1 -0
- package/dist/assert/match.js +28 -0
- package/dist/assert/match.js.map +1 -0
- package/dist/assert/rejects.cjs +49 -0
- package/dist/assert/rejects.cjs.map +1 -0
- package/dist/assert/rejects.d.cts +36 -0
- package/dist/assert/rejects.d.cts.map +1 -0
- package/dist/assert/rejects.d.ts +36 -0
- package/dist/assert/rejects.d.ts.map +1 -0
- package/dist/assert/rejects.js +46 -0
- package/dist/assert/rejects.js.map +1 -0
- package/dist/assert/round-to.cjs +54 -0
- package/dist/assert/round-to.cjs.map +1 -0
- package/dist/assert/round-to.d.cts +15 -0
- package/dist/assert/round-to.d.cts.map +1 -0
- package/dist/assert/round-to.d.ts +15 -0
- package/dist/assert/round-to.d.ts.map +1 -0
- package/dist/assert/round-to.js +51 -0
- package/dist/assert/round-to.js.map +1 -0
- package/dist/assert/starts-with.cjs +30 -0
- package/dist/assert/starts-with.cjs.map +1 -0
- package/dist/assert/starts-with.d.cts +14 -0
- package/dist/assert/starts-with.d.cts.map +1 -0
- package/dist/assert/starts-with.d.ts +14 -0
- package/dist/assert/starts-with.d.ts.map +1 -0
- package/dist/assert/starts-with.js +27 -0
- package/dist/assert/starts-with.js.map +1 -0
- package/dist/assert/throws.cjs +41 -0
- package/dist/assert/throws.cjs.map +1 -0
- package/dist/assert/throws.d.cts +36 -0
- package/dist/assert/throws.d.cts.map +1 -0
- package/dist/assert/throws.d.ts +36 -0
- package/dist/assert/throws.d.ts.map +1 -0
- package/dist/assert/throws.js +38 -0
- package/dist/assert/throws.js.map +1 -0
- package/dist/assert.cjs +143 -52
- package/dist/assert.cjs.map +1 -0
- package/dist/assert.d.cts +34 -2
- package/dist/assert.d.cts.map +1 -0
- package/dist/assert.d.ts +34 -2
- package/dist/assert.d.ts.map +1 -0
- package/dist/assert.js +87 -2
- package/dist/assert.js.map +1 -0
- package/dist/expect/after.cjs +15 -0
- package/dist/expect/after.cjs.map +1 -0
- package/dist/expect/after.js +16 -0
- package/dist/expect/after.js.map +1 -0
- package/dist/expect/ballpark.cjs +15 -0
- package/dist/expect/ballpark.cjs.map +1 -0
- package/dist/expect/ballpark.js +16 -0
- package/dist/expect/ballpark.js.map +1 -0
- package/dist/expect/before.cjs +15 -0
- package/dist/expect/before.cjs.map +1 -0
- package/dist/expect/before.js +16 -0
- package/dist/expect/before.js.map +1 -0
- package/dist/expect/between.cjs +15 -0
- package/dist/expect/between.cjs.map +1 -0
- package/dist/expect/between.js +16 -0
- package/dist/expect/between.js.map +1 -0
- package/dist/expect/empty.cjs +15 -0
- package/dist/expect/empty.cjs.map +1 -0
- package/dist/expect/empty.js +16 -0
- package/dist/expect/empty.js.map +1 -0
- package/dist/expect/end-with.cjs +15 -0
- package/dist/expect/end-with.cjs.map +1 -0
- package/dist/expect/end-with.js +16 -0
- package/dist/expect/end-with.js.map +1 -0
- package/dist/expect/eql.cjs +21 -0
- package/dist/expect/eql.cjs.map +1 -0
- package/dist/expect/eql.js +22 -0
- package/dist/expect/eql.js.map +1 -0
- package/dist/expect/equal-shorthand.cjs +34 -0
- package/dist/expect/equal-shorthand.cjs.map +1 -0
- package/dist/expect/equal-shorthand.js +33 -0
- package/dist/expect/equal-shorthand.js.map +1 -0
- package/dist/expect/equal.cjs +27 -0
- package/dist/expect/equal.cjs.map +1 -0
- package/dist/expect/equal.js +28 -0
- package/dist/expect/equal.js.map +1 -0
- package/dist/expect/excluding.cjs +19 -0
- package/dist/expect/excluding.cjs.map +1 -0
- package/dist/expect/excluding.js +18 -0
- package/dist/expect/excluding.js.map +1 -0
- package/dist/expect/greater-than-equal.cjs +25 -0
- package/dist/expect/greater-than-equal.cjs.map +1 -0
- package/dist/expect/greater-than-equal.js +26 -0
- package/dist/expect/greater-than-equal.js.map +1 -0
- package/dist/expect/greater-than.cjs +25 -0
- package/dist/expect/greater-than.cjs.map +1 -0
- package/dist/expect/greater-than.js +26 -0
- package/dist/expect/greater-than.js.map +1 -0
- package/dist/expect/has-property.cjs +20 -0
- package/dist/expect/has-property.cjs.map +1 -0
- package/dist/expect/has-property.js +21 -0
- package/dist/expect/has-property.js.map +1 -0
- package/dist/expect/include.cjs +21 -0
- package/dist/expect/include.cjs.map +1 -0
- package/dist/expect/include.js +22 -0
- package/dist/expect/include.js.map +1 -0
- package/dist/expect/instance-of-shorthand.cjs +24 -0
- package/dist/expect/instance-of-shorthand.cjs.map +1 -0
- package/dist/expect/instance-of-shorthand.js +25 -0
- package/dist/expect/instance-of-shorthand.js.map +1 -0
- package/dist/expect/instance-of.cjs +15 -0
- package/dist/expect/instance-of.cjs.map +1 -0
- package/dist/expect/instance-of.js +16 -0
- package/dist/expect/instance-of.js.map +1 -0
- package/dist/expect/keys.cjs +15 -0
- package/dist/expect/keys.cjs.map +1 -0
- package/dist/expect/keys.js +16 -0
- package/dist/expect/keys.js.map +1 -0
- package/dist/expect/length.cjs +21 -0
- package/dist/expect/length.cjs.map +1 -0
- package/dist/expect/length.js +22 -0
- package/dist/expect/length.js.map +1 -0
- package/dist/expect/less-than-equal.cjs +25 -0
- package/dist/expect/less-than-equal.cjs.map +1 -0
- package/dist/expect/less-than-equal.js +26 -0
- package/dist/expect/less-than-equal.js.map +1 -0
- package/dist/expect/less-than.cjs +25 -0
- package/dist/expect/less-than.cjs.map +1 -0
- package/dist/expect/less-than.js +26 -0
- package/dist/expect/less-than.js.map +1 -0
- package/dist/expect/match.cjs +15 -0
- package/dist/expect/match.cjs.map +1 -0
- package/dist/expect/match.js +16 -0
- package/dist/expect/match.js.map +1 -0
- package/dist/expect/members.cjs +41 -0
- package/dist/expect/members.cjs.map +1 -0
- package/dist/expect/members.js +42 -0
- package/dist/expect/members.js.map +1 -0
- package/dist/expect/reject.cjs +14 -0
- package/dist/expect/reject.cjs.map +1 -0
- package/dist/expect/reject.js +15 -0
- package/dist/expect/reject.js.map +1 -0
- package/dist/expect/round-to.cjs +15 -0
- package/dist/expect/round-to.cjs.map +1 -0
- package/dist/expect/round-to.js +16 -0
- package/dist/expect/round-to.js.map +1 -0
- package/dist/expect/start-with.cjs +15 -0
- package/dist/expect/start-with.cjs.map +1 -0
- package/dist/expect/start-with.js +16 -0
- package/dist/expect/start-with.js.map +1 -0
- package/dist/expect/throw.cjs +14 -0
- package/dist/expect/throw.cjs.map +1 -0
- package/dist/expect/throw.js +15 -0
- package/dist/expect/throw.js.map +1 -0
- package/dist/expect/type-shorthand.cjs +29 -0
- package/dist/expect/type-shorthand.cjs.map +1 -0
- package/dist/expect/type-shorthand.js +30 -0
- package/dist/expect/type-shorthand.js.map +1 -0
- package/dist/expect/type.cjs +15 -0
- package/dist/expect/type.cjs.map +1 -0
- package/dist/expect/type.js +16 -0
- package/dist/expect/type.js.map +1 -0
- package/dist/expect.cjs +144 -0
- package/dist/expect.cjs.map +1 -0
- package/dist/expect.d.cts +10 -0
- package/dist/expect.d.cts.map +1 -0
- package/dist/expect.d.ts +10 -0
- package/dist/expect.d.ts.map +1 -0
- package/dist/expect.js +141 -0
- package/dist/expect.js.map +1 -0
- package/dist/expect.types.d.cts +14 -404
- package/dist/expect.types.d.cts.map +1 -1
- package/dist/expect.types.d.ts +13 -405
- package/dist/expect.types.d.ts.map +1 -1
- package/dist/index.cjs +13 -582
- package/dist/index.d.cts +8 -469
- package/dist/index.d.ts +8 -469
- package/dist/index.js +8 -575
- package/dist/mixins.cjs +11 -0
- package/dist/mixins.cjs.map +1 -0
- package/dist/mixins.d.cts +28 -0
- package/dist/mixins.d.cts.map +1 -0
- package/dist/mixins.d.ts +28 -0
- package/dist/mixins.d.ts.map +1 -0
- package/dist/mixins.js +9 -0
- package/dist/mixins.js.map +1 -0
- package/dist/utils/chain.cjs +20 -0
- package/dist/utils/chain.cjs.map +1 -0
- package/dist/utils/chain.js +18 -0
- package/dist/utils/chain.js.map +1 -0
- package/dist/utils/fail.cjs +16 -0
- package/dist/utils/fail.cjs.map +1 -0
- package/dist/utils/fail.d.cts +9 -0
- package/dist/utils/fail.d.cts.map +1 -0
- package/dist/utils/fail.d.ts +9 -0
- package/dist/utils/fail.d.ts.map +1 -0
- package/dist/utils/fail.js +14 -0
- package/dist/utils/fail.js.map +1 -0
- package/dist/utils/get-size.cjs +17 -0
- package/dist/utils/get-size.cjs.map +1 -0
- package/dist/utils/get-size.js +15 -0
- package/dist/utils/get-size.js.map +1 -0
- package/dist/utils/get-type.cjs +12 -0
- package/dist/utils/get-type.cjs.map +1 -0
- package/dist/utils/get-type.d.cts +5 -0
- package/dist/utils/get-type.d.cts.map +1 -0
- package/dist/utils/get-type.d.ts +5 -0
- package/dist/utils/get-type.d.ts.map +1 -0
- package/dist/utils/get-type.js +11 -0
- package/dist/utils/get-type.js.map +1 -0
- package/dist/utils/match.cjs +118 -0
- package/dist/utils/match.cjs.map +1 -0
- package/dist/utils/match.d.cts +7 -0
- package/dist/utils/match.d.cts.map +1 -0
- package/dist/utils/match.d.ts +7 -0
- package/dist/utils/match.d.ts.map +1 -0
- package/dist/utils/match.js +114 -0
- package/dist/utils/match.js.map +1 -0
- package/dist/utils/process-error.cjs +86 -0
- package/dist/utils/process-error.cjs.map +1 -0
- package/dist/utils/process-error.d.cts +8 -0
- package/dist/utils/process-error.d.cts.map +1 -0
- package/dist/utils/process-error.d.ts +10 -0
- package/dist/utils/process-error.d.ts.map +1 -0
- package/dist/utils/process-error.js +85 -0
- package/dist/utils/process-error.js.map +1 -0
- package/dist/utils/validate-numeric-and-dates.cjs +20 -0
- package/dist/utils/validate-numeric-and-dates.cjs.map +1 -0
- package/dist/utils/validate-numeric-and-dates.js +18 -0
- package/dist/utils/validate-numeric-and-dates.js.map +1 -0
- package/dist/utils/xor.cjs +9 -0
- package/dist/utils/xor.cjs.map +1 -0
- package/dist/utils/xor.js +8 -0
- package/dist/utils/xor.js.map +1 -0
- package/package.json +1 -1
- package/dist/assert-CJsbhtgi.d.ts +0 -519
- package/dist/assert-CJsbhtgi.d.ts.map +0 -1
- package/dist/assert-DZjgWjOw.cjs +0 -1626
- package/dist/assert-DZjgWjOw.cjs.map +0 -1
- package/dist/assert-itrfuDRd.d.cts +0 -518
- package/dist/assert-itrfuDRd.d.cts.map +0 -1
- package/dist/assert-kFXp7i_B.js +0 -1260
- package/dist/assert-kFXp7i_B.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- /package/dist/{chunk-CTAAG5j7.js → _virtual/rolldown_runtime.js} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { State } from "./mixins.cjs";
|
|
2
|
+
import { Expect } from "./expect.types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/expect.d.ts
|
|
5
|
+
|
|
6
|
+
declare const expectChain: <T>(state: State<T>) => any;
|
|
7
|
+
declare const expect: Expect;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { expect, expectChain };
|
|
10
|
+
//# sourceMappingURL=expect.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect.d.cts","names":[],"sources":["../src/expect.ts"],"sourcesContent":[],"mappings":";;;;;cA0Da,wBAAyB,MAAM;cA8B/B,QAEP"}
|
package/dist/expect.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { State } from "./mixins.js";
|
|
2
|
+
import { Expect } from "./expect.types.js";
|
|
3
|
+
|
|
4
|
+
//#region src/expect.d.ts
|
|
5
|
+
|
|
6
|
+
declare const expectChain: <T>(state: State<T>) => any;
|
|
7
|
+
declare const expect: Expect;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { expect, expectChain };
|
|
10
|
+
//# sourceMappingURL=expect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect.d.ts","names":[],"sources":["../src/expect.ts"],"sourcesContent":[],"mappings":";;;;;cA0Da,wBAAyB,MAAM;cA8B/B,QAEP"}
|
package/dist/expect.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { mixins, use } from "./mixins.js";
|
|
2
|
+
import { registerMethod, registerProperty } from "./utils/chain.js";
|
|
3
|
+
import { getSize } from "./utils/get-size.js";
|
|
4
|
+
import "./expect/after.js";
|
|
5
|
+
import "./expect/ballpark.js";
|
|
6
|
+
import "./expect/before.js";
|
|
7
|
+
import "./expect/between.js";
|
|
8
|
+
import "./expect/empty.js";
|
|
9
|
+
import "./expect/end-with.js";
|
|
10
|
+
import "./expect/eql.js";
|
|
11
|
+
import "./expect/equal-shorthand.js";
|
|
12
|
+
import "./expect/equal.js";
|
|
13
|
+
import "./expect/excluding.js";
|
|
14
|
+
import "./expect/greater-than-equal.js";
|
|
15
|
+
import "./expect/greater-than.js";
|
|
16
|
+
import "./expect/has-property.js";
|
|
17
|
+
import "./expect/include.js";
|
|
18
|
+
import "./expect/instance-of-shorthand.js";
|
|
19
|
+
import "./expect/instance-of.js";
|
|
20
|
+
import "./expect/keys.js";
|
|
21
|
+
import "./expect/length.js";
|
|
22
|
+
import "./expect/less-than-equal.js";
|
|
23
|
+
import "./expect/less-than.js";
|
|
24
|
+
import "./expect/match.js";
|
|
25
|
+
import "./expect/members.js";
|
|
26
|
+
import "./expect/reject.js";
|
|
27
|
+
import "./expect/round-to.js";
|
|
28
|
+
import "./expect/start-with.js";
|
|
29
|
+
import "./expect/throw.js";
|
|
30
|
+
import "./expect/type-shorthand.js";
|
|
31
|
+
import "./expect/type.js";
|
|
32
|
+
import { fail } from "./utils/fail.js";
|
|
33
|
+
import mapValues from "lodash/mapValues.js";
|
|
34
|
+
|
|
35
|
+
//#region src/expect.ts
|
|
36
|
+
use({
|
|
37
|
+
to: {
|
|
38
|
+
type: "property",
|
|
39
|
+
value: () => null
|
|
40
|
+
},
|
|
41
|
+
be: {
|
|
42
|
+
type: "property",
|
|
43
|
+
value: () => null
|
|
44
|
+
},
|
|
45
|
+
a: {
|
|
46
|
+
type: "property",
|
|
47
|
+
value: () => null
|
|
48
|
+
},
|
|
49
|
+
an: {
|
|
50
|
+
type: "property",
|
|
51
|
+
value: () => null
|
|
52
|
+
},
|
|
53
|
+
and: {
|
|
54
|
+
type: "property",
|
|
55
|
+
value: ({ value, every,...rest }) => {
|
|
56
|
+
const values = mapValues(rest, () => {});
|
|
57
|
+
return {
|
|
58
|
+
value,
|
|
59
|
+
every,
|
|
60
|
+
...values
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
have: {
|
|
65
|
+
type: "property",
|
|
66
|
+
value: () => null
|
|
67
|
+
},
|
|
68
|
+
in: {
|
|
69
|
+
type: "property",
|
|
70
|
+
value: () => null
|
|
71
|
+
},
|
|
72
|
+
not: {
|
|
73
|
+
type: "property",
|
|
74
|
+
value: (state) => ({
|
|
75
|
+
...state,
|
|
76
|
+
inverted: !state.inverted
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
of: {
|
|
80
|
+
type: "property",
|
|
81
|
+
value: () => null
|
|
82
|
+
},
|
|
83
|
+
length: {
|
|
84
|
+
type: "property",
|
|
85
|
+
value: (state) => ({
|
|
86
|
+
...state,
|
|
87
|
+
getProperty: getSize
|
|
88
|
+
})
|
|
89
|
+
},
|
|
90
|
+
deep: {
|
|
91
|
+
type: "property",
|
|
92
|
+
value: (state) => ({
|
|
93
|
+
...state,
|
|
94
|
+
deep: true
|
|
95
|
+
})
|
|
96
|
+
},
|
|
97
|
+
every: {
|
|
98
|
+
type: "property",
|
|
99
|
+
value: (state) => ({
|
|
100
|
+
...state,
|
|
101
|
+
every: true
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const expectChain = (state) => {
|
|
106
|
+
const chain = {};
|
|
107
|
+
for (const [key, v] of Object.entries(mixins)) {
|
|
108
|
+
const definition = v.type === "alias" ? mixins[v.value] : v;
|
|
109
|
+
if (definition.type === "property") registerProperty(chain, key, () => {
|
|
110
|
+
const newState = definition.value(state);
|
|
111
|
+
return expectChain({
|
|
112
|
+
...state,
|
|
113
|
+
...newState
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
else if (definition.type === "method") registerMethod(chain, key, (...args) => {
|
|
117
|
+
if (state.getProperty) definition.value({
|
|
118
|
+
value: state.getProperty(state.value),
|
|
119
|
+
inverted: state.inverted
|
|
120
|
+
})(...args);
|
|
121
|
+
else if (state.every) for (const value of state.value) definition.value({
|
|
122
|
+
...state,
|
|
123
|
+
value
|
|
124
|
+
})(...args);
|
|
125
|
+
else {
|
|
126
|
+
const result = definition.value({ ...state })(...args);
|
|
127
|
+
if (result) return result;
|
|
128
|
+
}
|
|
129
|
+
return expectChain(state);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return chain;
|
|
133
|
+
};
|
|
134
|
+
const expect = ((actual) => {
|
|
135
|
+
return expectChain({ value: actual });
|
|
136
|
+
});
|
|
137
|
+
expect.fail = fail;
|
|
138
|
+
|
|
139
|
+
//#endregion
|
|
140
|
+
export { expect, expectChain };
|
|
141
|
+
//# sourceMappingURL=expect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect.js","names":[],"sources":["../src/expect.ts"],"sourcesContent":["import { mixins, type State, use } from './mixins.js';\nimport { registerMethod, registerProperty } from './utils/chain.js';\nimport { getSize } from './utils/get-size.js';\nimport './expect/after.js';\nimport './expect/ballpark.js';\nimport './expect/before.js';\nimport './expect/between.js';\nimport './expect/empty.js';\nimport './expect/end-with.js';\nimport './expect/eql.js';\nimport './expect/equal-shorthand.js';\nimport './expect/equal.js';\nimport './expect/excluding.js';\nimport './expect/greater-than-equal.js';\nimport './expect/greater-than.js';\nimport './expect/has-property.js';\nimport './expect/include.js';\nimport './expect/instance-of-shorthand.js';\nimport './expect/instance-of.js';\nimport './expect/keys.js';\nimport './expect/length.js';\nimport './expect/less-than-equal.js';\nimport './expect/less-than.js';\nimport './expect/match.js';\nimport './expect/members.js';\nimport './expect/reject.js';\nimport './expect/round-to.js';\nimport './expect/start-with.js';\nimport './expect/throw.js';\nimport './expect/type-shorthand.js';\nimport './expect/type.js';\nimport mapValues from 'lodash/mapValues.js';\nimport { fail } from './utils/fail.js';\nimport { type Expect } from './expect.types.js';\n\nuse({\n to: { type: 'property', value: () => null },\n be: { type: 'property', value: () => null },\n a: { type: 'property', value: () => null },\n an: { type: 'property', value: () => null },\n and: {\n type: 'property',\n value: ({ value, every, ...rest }) => {\n const values = mapValues(rest, () => {}) as any;\n return { value, every, ...values };\n }\n },\n have: { type: 'property', value: () => null },\n in: { type: 'property', value: () => null },\n not: { type: 'property', value: (state) => ({ ...state, inverted: !state.inverted }) },\n of: { type: 'property', value: () => null },\n\n length: { type: 'property', value: (state) => ({ ...state, getProperty: getSize }) },\n deep: { type: 'property', value: (state) => ({ ...state, deep: true }) },\n\n every: { type: 'property', value: (state) => ({ ...state, every: true }) }\n});\n\nexport const expectChain = <T>(state: State<T>) => {\n const chain = {} as any;\n for (const [key, v] of Object.entries(mixins)) {\n const definition = v.type === 'alias' ? mixins[v.value] : v;\n if (definition.type === 'property') {\n registerProperty(chain, key, () => {\n const newState = definition.value(state);\n return expectChain({ ...state, ...newState });\n });\n } else if (definition.type === 'method') {\n registerMethod(chain, key, (...args: any[]) => {\n if (state.getProperty) {\n definition.value({ value: state.getProperty(state.value), inverted: state.inverted })(...args);\n } else if (state.every) {\n for (const value of state.value as any) {\n definition.value({ ...state, value })(...args);\n }\n } else {\n const result = definition.value({ ...state })(...args);\n if (result as any) {\n return result;\n }\n }\n return expectChain(state);\n });\n }\n }\n return chain;\n};\n\nexport const expect = (<T>(actual: T) => {\n return expectChain({ value: actual });\n}) as Expect;\n\nexpect.fail = fail;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAI;CACA,IAAI;EAAE,MAAM;EAAY,aAAa;EAAM;CAC3C,IAAI;EAAE,MAAM;EAAY,aAAa;EAAM;CAC3C,GAAG;EAAE,MAAM;EAAY,aAAa;EAAM;CAC1C,IAAI;EAAE,MAAM;EAAY,aAAa;EAAM;CAC3C,KAAK;EACD,MAAM;EACN,QAAQ,EAAE,OAAO,MAAO,GAAG,WAAW;GAClC,MAAM,SAA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,QAAI,OACA,QAAO;;AAGf,UAAO,YAAY,MAAM;IAC3B;;AAGV,QAAO;;AAGX,MAAa,WAAc,WAAc;AACrC,QAAO,YAAY,EAAE,OAAO,QAAQ,CAAC;;AAGzC,OAAO,OAAO"}
|
package/dist/expect.types.d.cts
CHANGED
|
@@ -1,37 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type ErrorPredicate = (error: Error) => boolean;
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/assert/throws.d.ts
|
|
8
|
-
type ThrowsCallback = () => unknown;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/utils/fail.d.ts
|
|
11
|
-
/**
|
|
12
|
-
* Throw an AssertionError
|
|
13
|
-
* @param {string} message - The message to pass to the AssertionError
|
|
14
|
-
*/
|
|
15
|
-
declare const fail: (message?: string) => never;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/utils/types.d.ts
|
|
18
|
-
type DeepPartial<T> = { [P in keyof T]?: T[P] | (T[P] extends Array<infer U> ? Array<DeepPartial<U>> : DeepPartial<T[P]>) };
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/utils/get-type.d.ts
|
|
21
|
-
type ValueType = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function' | 'null' | 'NaN' | 'array';
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/mixins.d.ts
|
|
24
|
-
interface State<T> {
|
|
25
|
-
inverted?: boolean;
|
|
26
|
-
value?: T;
|
|
27
|
-
getProperty?: (value: T) => any;
|
|
28
|
-
deep?: boolean;
|
|
29
|
-
same?: boolean;
|
|
30
|
-
ordered?: boolean;
|
|
31
|
-
partial?: boolean;
|
|
32
|
-
every?: boolean;
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
1
|
+
import { ThrowsCallback } from "./assert/throws.cjs";
|
|
2
|
+
import { fail } from "./utils/fail.cjs";
|
|
3
|
+
import { State } from "./mixins.cjs";
|
|
4
|
+
|
|
35
5
|
//#region src/expect.types.d.ts
|
|
36
6
|
interface ValueExpect<T> {
|
|
37
7
|
to: this;
|
|
@@ -47,388 +17,27 @@ interface ValueExpect<T> {
|
|
|
47
17
|
* Use deep equality for object checks
|
|
48
18
|
*/
|
|
49
19
|
deep: this;
|
|
50
|
-
/**
|
|
51
|
-
* check for deep equality
|
|
52
|
-
*/
|
|
53
|
-
eql(value: T, message?: string): this;
|
|
54
|
-
partially: ValueExpect<DeepPartial<T>>;
|
|
55
|
-
/**
|
|
56
|
-
* check for === equality, NaN is considered equal to NaN
|
|
57
|
-
*/
|
|
58
|
-
equal(value: T, message?: string): this;
|
|
59
|
-
/**
|
|
60
|
-
* check for === equality, NaN is considered equal to NaN
|
|
61
|
-
*/
|
|
62
|
-
eq(value: T, message?: string): this;
|
|
63
|
-
/**
|
|
64
|
-
* check if value has a property
|
|
65
|
-
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
66
|
-
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
67
|
-
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
68
|
-
*/
|
|
69
|
-
property<K extends keyof T>(property: K): this;
|
|
70
|
-
/**
|
|
71
|
-
* check if value has a property
|
|
72
|
-
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
73
|
-
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
74
|
-
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
75
|
-
*/
|
|
76
|
-
property(property: string): this;
|
|
77
|
-
/**
|
|
78
|
-
* check if value has a property
|
|
79
|
-
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
80
|
-
* @param value
|
|
81
|
-
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
82
|
-
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
83
|
-
*/
|
|
84
|
-
property<K extends keyof T>(property: K, value?: any): this;
|
|
85
|
-
/**
|
|
86
|
-
* check if value has a property
|
|
87
|
-
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
88
|
-
* @param value
|
|
89
|
-
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
90
|
-
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
91
|
-
*/
|
|
92
|
-
property(property: string, value?: any): this;
|
|
93
|
-
/**
|
|
94
|
-
* check if instance of value
|
|
95
|
-
* @param constructor - The constructor function to check against
|
|
96
|
-
*/
|
|
97
|
-
instanceOf(constructor: Constructor): this;
|
|
98
|
-
/**
|
|
99
|
-
* check if value is null
|
|
100
|
-
*/
|
|
101
|
-
null(): this;
|
|
102
|
-
/**
|
|
103
|
-
* check if value is undefined
|
|
104
|
-
*/
|
|
105
|
-
undefined(): this;
|
|
106
|
-
/**
|
|
107
|
-
* check if value is of certain type
|
|
108
|
-
*/
|
|
109
|
-
type(type: ValueType): this;
|
|
110
20
|
}
|
|
111
|
-
type ArrayType<T
|
|
21
|
+
type ArrayType<T> = T extends (infer U)[] ? U : never;
|
|
112
22
|
interface ArrayExpect<T> extends ValueExpect<T>, ObjectExpect<T> {
|
|
113
23
|
length: NumberExpect<number> & this;
|
|
114
24
|
array(): this;
|
|
115
25
|
every: GetExpectType<ArrayType<T>>;
|
|
116
|
-
/**
|
|
117
|
-
* check if array includes element(s)
|
|
118
|
-
*/
|
|
119
|
-
include(...elements: ArrayType<T>[]): this;
|
|
120
|
-
/**
|
|
121
|
-
* check if array includes element(s)
|
|
122
|
-
*/
|
|
123
|
-
contain(...elements: ArrayType<T>[]): this;
|
|
124
|
-
/**
|
|
125
|
-
* check for array length
|
|
126
|
-
*/
|
|
127
|
-
lengthOf(length: number, message?: string): this;
|
|
128
|
-
/**
|
|
129
|
-
* check that the members in second array are present in the first one
|
|
130
|
-
*/
|
|
131
|
-
members(value: ArrayType<T, any>[], message?: string): this;
|
|
132
|
-
same: ArrayExpect<T>;
|
|
133
|
-
ordered: ArrayExpect<T>;
|
|
134
|
-
/**
|
|
135
|
-
* Use partial matching for objects
|
|
136
|
-
* @example
|
|
137
|
-
* expect({ a: 1, b: 2 }).to.partially.eql({ a: 1 });
|
|
138
|
-
*/
|
|
139
|
-
partially: ArrayExpect<DeepPartial<T>>;
|
|
140
|
-
/**
|
|
141
|
-
* check if value is an array
|
|
142
|
-
*/
|
|
143
|
-
array(): this;
|
|
144
26
|
}
|
|
145
|
-
interface BigIntExpect<T = bigint> extends NumberExpect<T> {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
interface BooleanExpect<T = boolean> extends ValueExpect<T> {
|
|
152
|
-
/**
|
|
153
|
-
* check if value is a boolean
|
|
154
|
-
*/
|
|
155
|
-
boolean(): this;
|
|
156
|
-
/**
|
|
157
|
-
* check if value is true
|
|
158
|
-
*/
|
|
159
|
-
true(): this;
|
|
160
|
-
/**
|
|
161
|
-
* check if value is false
|
|
162
|
-
*/
|
|
163
|
-
false(): this;
|
|
164
|
-
}
|
|
165
|
-
interface DateExpect<T = Date> extends ValueExpect<T>, ObjectExpect<T> {
|
|
166
|
-
/**
|
|
167
|
-
* check if date is after other date
|
|
168
|
-
* @param date
|
|
169
|
-
*/
|
|
170
|
-
after(date: Date): this;
|
|
171
|
-
/**
|
|
172
|
-
* check if date is before other date
|
|
173
|
-
* @param date
|
|
174
|
-
*/
|
|
175
|
-
before(date: Date): this;
|
|
176
|
-
/**
|
|
177
|
-
* check if date is between other dates
|
|
178
|
-
* @param start
|
|
179
|
-
* @param end
|
|
180
|
-
*/
|
|
181
|
-
between(start: Date, end: Date, inclusive?: boolean): this;
|
|
182
|
-
/**
|
|
183
|
-
* check if actual is greater than or equal to expected
|
|
184
|
-
*/
|
|
185
|
-
greaterThanOrEqual(value: T): this;
|
|
186
|
-
/**
|
|
187
|
-
* check if actual is greater than or equal to expected
|
|
188
|
-
*/
|
|
189
|
-
gte(value: T): this;
|
|
190
|
-
/**
|
|
191
|
-
* check if actual is greater than or equal to expected
|
|
192
|
-
*/
|
|
193
|
-
atLeast(value: T): this;
|
|
194
|
-
/**
|
|
195
|
-
* check if actual is greater than expected
|
|
196
|
-
*/
|
|
197
|
-
greaterThan(value: T): this;
|
|
198
|
-
/**
|
|
199
|
-
* check if actual is greater than expected
|
|
200
|
-
*/
|
|
201
|
-
gt(value: T): this;
|
|
202
|
-
/**
|
|
203
|
-
* check if actual is greater than expected
|
|
204
|
-
*/
|
|
205
|
-
above(value: T): this;
|
|
206
|
-
/**
|
|
207
|
-
* check if value is an instance of Date
|
|
208
|
-
*/
|
|
209
|
-
Date(): this;
|
|
210
|
-
/**
|
|
211
|
-
* check if actual is less than or equal to expected
|
|
212
|
-
*/
|
|
213
|
-
lessThanOrEqual(value: T): this;
|
|
214
|
-
/**
|
|
215
|
-
* check if actual is less than or equal to expected
|
|
216
|
-
*/
|
|
217
|
-
lte(value: T): this;
|
|
218
|
-
/**
|
|
219
|
-
* check if actual is less than or equal to expected
|
|
220
|
-
*/
|
|
221
|
-
atMost(value: T): this;
|
|
222
|
-
/**
|
|
223
|
-
* check if actual is less than expected
|
|
224
|
-
*/
|
|
225
|
-
lessThan(value: T): this;
|
|
226
|
-
/**
|
|
227
|
-
* check if actual is less than expected
|
|
228
|
-
*/
|
|
229
|
-
lt(value: T): this;
|
|
230
|
-
/**
|
|
231
|
-
* check if actual is less than expected
|
|
232
|
-
*/
|
|
233
|
-
below(value: T): this;
|
|
234
|
-
}
|
|
235
|
-
interface FunctionExpect<T> extends ValueExpect<T> {
|
|
236
|
-
/**
|
|
237
|
-
* check if function throws
|
|
238
|
-
* @param message
|
|
239
|
-
*/
|
|
240
|
-
throw(message?: string): this;
|
|
241
|
-
throw(matcher: RegExp | Constructor<Error> | ErrorPredicate, message?: string): this;
|
|
242
|
-
/**
|
|
243
|
-
* check if value is a function
|
|
244
|
-
*/
|
|
245
|
-
function(): this;
|
|
246
|
-
}
|
|
247
|
-
interface NumberExpect<T = number> extends ValueExpect<T> {
|
|
248
|
-
/**
|
|
249
|
-
* check if number close enough (default 10%)
|
|
250
|
-
* @param ballpark
|
|
251
|
-
* @param [multiplier=10] - a number between 0 and 1 (exclusive). 0.1 (default) means 10% difference is allowed.
|
|
252
|
-
*/
|
|
253
|
-
ballpark(ballpark: number, multiplier?: number): this;
|
|
254
|
-
/**
|
|
255
|
-
* check if number is between other numbers
|
|
256
|
-
* @param start
|
|
257
|
-
* @param end
|
|
258
|
-
* @param inclusive
|
|
259
|
-
*/
|
|
260
|
-
between(start: number, end: number, inclusive?: boolean): this;
|
|
261
|
-
/**
|
|
262
|
-
* check if actual is greater than or equal to expected
|
|
263
|
-
*/
|
|
264
|
-
greaterThanOrEqual(value: T): this;
|
|
265
|
-
/**
|
|
266
|
-
* check if actual is greater than or equal to expected
|
|
267
|
-
*/
|
|
268
|
-
gte(value: T): this;
|
|
269
|
-
/**
|
|
270
|
-
* check if actual is greater than or equal to expected
|
|
271
|
-
*/
|
|
272
|
-
atLeast(value: T): this;
|
|
273
|
-
/**
|
|
274
|
-
* check if actual is greater than expected
|
|
275
|
-
*/
|
|
276
|
-
greaterThan(value: T): this;
|
|
277
|
-
/**
|
|
278
|
-
* check if actual is greater than expected
|
|
279
|
-
*/
|
|
280
|
-
gt(value: T): this;
|
|
281
|
-
/**
|
|
282
|
-
* check if actual is greater than expected
|
|
283
|
-
*/
|
|
284
|
-
above(value: T): this;
|
|
285
|
-
/**
|
|
286
|
-
* check if actual is less than or equal to expected
|
|
287
|
-
*/
|
|
288
|
-
lessThanOrEqual(value: T): this;
|
|
289
|
-
/**
|
|
290
|
-
* check if actual is less than or equal to expected
|
|
291
|
-
*/
|
|
292
|
-
lte(value: T): this;
|
|
293
|
-
/**
|
|
294
|
-
* check if actual is less than or equal to expected
|
|
295
|
-
*/
|
|
296
|
-
atMost(value: T): this;
|
|
297
|
-
/**
|
|
298
|
-
* check if actual is less than expected
|
|
299
|
-
*/
|
|
300
|
-
lessThan(value: T): this;
|
|
301
|
-
/**
|
|
302
|
-
* check if actual is less than expected
|
|
303
|
-
*/
|
|
304
|
-
lt(value: T): this;
|
|
305
|
-
/**
|
|
306
|
-
* check if actual is less than expected
|
|
307
|
-
*/
|
|
308
|
-
below(value: T): this;
|
|
309
|
-
/**
|
|
310
|
-
* check if number close enough (default 10%)
|
|
311
|
-
* @param target
|
|
312
|
-
* @param decimal defaults to 0, can be negative if trying to round down to nearest 10, 100, etc
|
|
313
|
-
*/
|
|
314
|
-
roundTo(target: number, decimal?: number): this;
|
|
315
|
-
/**
|
|
316
|
-
* check if value is a number
|
|
317
|
-
*/
|
|
318
|
-
number(): this;
|
|
319
|
-
/**
|
|
320
|
-
* check if value is a NaN
|
|
321
|
-
*/
|
|
322
|
-
NaN(): this;
|
|
323
|
-
}
|
|
324
|
-
type InferMapKeys<T> = T extends Map<infer K, any> ? K : never;
|
|
27
|
+
interface BigIntExpect<T = bigint> extends NumberExpect<T> {}
|
|
28
|
+
interface BooleanExpect<T = boolean> extends ValueExpect<T> {}
|
|
29
|
+
interface DateExpect<T = Date> extends ValueExpect<T>, ObjectExpect<T> {}
|
|
30
|
+
interface FunctionExpect<T> extends ValueExpect<T> {}
|
|
31
|
+
interface NumberExpect<T = number> extends ValueExpect<T> {}
|
|
325
32
|
interface MapExpect<T> extends ValueExpect<T> {
|
|
326
33
|
size: NumberExpect<number>;
|
|
327
|
-
/**
|
|
328
|
-
* check if Map is empty
|
|
329
|
-
*/
|
|
330
|
-
empty(message?: string): this;
|
|
331
|
-
/**
|
|
332
|
-
* check if value is an instance of Map
|
|
333
|
-
*/
|
|
334
|
-
Map(): this;
|
|
335
|
-
/**
|
|
336
|
-
* Check if value has keys
|
|
337
|
-
*/
|
|
338
|
-
keys<K extends InferMapKeys<T>>(keys: K[] | K): this;
|
|
339
|
-
/**
|
|
340
|
-
* check for Map to have a certain size
|
|
341
|
-
*/
|
|
342
|
-
sizeOf(size: number, message?: string): this;
|
|
343
34
|
}
|
|
344
35
|
interface ObjectExpect<T> extends ValueExpect<T> {
|
|
345
36
|
size: NumberExpect<number>;
|
|
346
|
-
/**
|
|
347
|
-
* check if object/array/Map/Set is empty
|
|
348
|
-
*/
|
|
349
|
-
empty(message?: string): this;
|
|
350
|
-
/**
|
|
351
|
-
* exclude keys from object to be compared further down the chain
|
|
352
|
-
* @param keys
|
|
353
|
-
*/
|
|
354
|
-
excluding<K extends keyof T>(...keys: K[]): ObjectExpect<Omit<T, K>>;
|
|
355
|
-
/**
|
|
356
|
-
* check if value is an instance of Map
|
|
357
|
-
*/
|
|
358
|
-
Map(): this;
|
|
359
|
-
/**
|
|
360
|
-
* check if value is an instance of Set
|
|
361
|
-
*/
|
|
362
|
-
Set(): this;
|
|
363
|
-
/**
|
|
364
|
-
* check if value is an instance of WeakMap
|
|
365
|
-
*/
|
|
366
|
-
WeakMap(): this;
|
|
367
|
-
/**
|
|
368
|
-
* check if value is an instance of WeakSet
|
|
369
|
-
*/
|
|
370
|
-
WeakSet(): this;
|
|
371
|
-
/**
|
|
372
|
-
* Check if value has keys
|
|
373
|
-
*/
|
|
374
|
-
keys<K extends keyof T>(keys: K[] | K): this;
|
|
375
|
-
/**
|
|
376
|
-
* check for object/array/Map/Set/string to have a certain size
|
|
377
|
-
*/
|
|
378
|
-
sizeOf(size: number, message?: string): this;
|
|
379
|
-
/**
|
|
380
|
-
* check if value is a plain object
|
|
381
|
-
*/
|
|
382
|
-
object(): this;
|
|
383
|
-
}
|
|
384
|
-
interface PromiseExpect<T> extends ValueExpect<T> {
|
|
385
|
-
/**
|
|
386
|
-
* check if promise rejects
|
|
387
|
-
* @param message
|
|
388
|
-
*/
|
|
389
|
-
reject(message?: string): Promise<void>;
|
|
390
|
-
reject(matcher: RegExp | Constructor<Error> | ErrorPredicate): Promise<void>;
|
|
391
|
-
}
|
|
392
|
-
interface StringExpect<T = string> extends ValueExpect<T> {
|
|
393
|
-
/**
|
|
394
|
-
* check if string ends with other string
|
|
395
|
-
* @param start
|
|
396
|
-
* @example endsWith('foo', 'o');
|
|
397
|
-
*/
|
|
398
|
-
endWith(end: string): this;
|
|
399
|
-
/**
|
|
400
|
-
* check if string includes substring(s)
|
|
401
|
-
*/
|
|
402
|
-
include(...substrings: string[]): this;
|
|
403
|
-
/**
|
|
404
|
-
* check if string includes substring(s)
|
|
405
|
-
*/
|
|
406
|
-
contain(...substrings: string[]): this;
|
|
407
|
-
/**
|
|
408
|
-
* check for string to have a certain size
|
|
409
|
-
*/
|
|
410
|
-
lengthOf(length: number, message?: string): this;
|
|
411
|
-
/**
|
|
412
|
-
* check if string matches regex
|
|
413
|
-
*/
|
|
414
|
-
match(regex: RegExp): this;
|
|
415
|
-
/**
|
|
416
|
-
* check if string starts with other string
|
|
417
|
-
* @param start
|
|
418
|
-
* @example startsWith('foo', 'f');
|
|
419
|
-
*/
|
|
420
|
-
startWith(start: string): this;
|
|
421
|
-
/**
|
|
422
|
-
* check if value is a string
|
|
423
|
-
*/
|
|
424
|
-
string(): this;
|
|
425
|
-
}
|
|
426
|
-
interface SymbolExpect<T> extends ValueExpect<T> {
|
|
427
|
-
/**
|
|
428
|
-
* check if value is a symbol
|
|
429
|
-
*/
|
|
430
|
-
symbol(): this;
|
|
431
37
|
}
|
|
38
|
+
interface PromiseExpect<T> extends ValueExpect<T> {}
|
|
39
|
+
interface StringExpect<T = string> extends ValueExpect<T> {}
|
|
40
|
+
interface SymbolExpect<T> extends ValueExpect<T> {}
|
|
432
41
|
declare const LooseSymbol: unique symbol;
|
|
433
42
|
interface Loose {
|
|
434
43
|
[LooseSymbol]: true;
|
|
@@ -452,6 +61,7 @@ interface Expect {
|
|
|
452
61
|
}
|
|
453
62
|
type GetExpectType<T> = T extends number ? NumberExpect<T> : AllExpects<T>;
|
|
454
63
|
//# sourceMappingURL=expect.types.d.ts.map
|
|
64
|
+
|
|
455
65
|
//#endregion
|
|
456
66
|
export { ArrayExpect, BigIntExpect, BooleanExpect, DateExpect, Expect, FunctionExpect, Loose, MapExpect, NumberExpect, ObjectExpect, PromiseExpect, type State, StringExpect, SymbolExpect, ValueExpect };
|
|
457
67
|
//# sourceMappingURL=expect.types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expect.types.d.cts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"expect.types.d.cts","names":[],"sources":["../src/expect.types.ts"],"sourcesContent":[],"mappings":";;;;;UAKiB;;EAAA,EAAA,EAAA,IAAA;EAgBZ,CAAA,EAAA,IAAA;EAAS,EAAA,EAAA,IAAA;KAAM,EAAA,IAAA;KAAwB,EAAA,IAAA;EAAC,IAAA,EAAA,IAAA;EAE5B,EAAA,EAAA,IAAA;EAAW,EAAA,EAAA,IAAA;;;;MAGO,EAAA,IAAA;;KAL9B,SAKM,CAAA,CAAA,CAAA,GALS,CAKT,SAAA,CAAA,KAAA,EAAA,CAAA,EAAA,GALiC,CAKjC,GAAA,KAAA;AAH6B,UAAvB,WAAuB,CAAA,CAAA,CAAA,SAAA,WAAA,CAAY,CAAZ,CAAA,EAAgB,YAAhB,CAA6B,CAA7B,CAAA,CAAA;QAAgB,EAC5C,YAD4C,CAAA,MAAA,CAAA,GAAA,IAAA;EAAY,KAAA,EAAA,EAAA,IAAA;EAKnD,KAAA,EAFN,aAEkB,CAFJ,SAEI,CAFM,CAEN,CAAA,CAAA;;AAAkC,UAA9C,YAA8C,CAAA,IAAA,MAAA,CAAA,SAAb,YAAa,CAAA,CAAA,CAAA,CAAA;AAAD,UAC7C,aAD6C,CAAA,IAAA,OAAA,CAAA,SACV,WADU,CACE,CADF,CAAA,CAAA,CAC9D;AAA8B,UACb,UADa,CAAA,IACE,IADF,CAAA,SACgB,WADhB,CAC4B,CAD5B,CAAA,EACgC,YADhC,CAC6C,CAD7C,CAAA,CAAA;AAAsB,UAEnC,cAFmC,CAAA,CAAA,CAAA,SAET,WAFS,CAEG,CAFH,CAAA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