hein 2.0.0-alpha.0 → 2.0.0-alpha.1
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/{assert-B_vcZS90.d.ts → assert-ChQPKP5C.d.cts} +5 -6
- package/dist/assert-ChQPKP5C.d.cts.map +1 -0
- package/dist/{assert-9EsvfQwn.d.cts → assert-CsN7srt-.d.ts} +3 -8
- package/dist/assert-CsN7srt-.d.ts.map +1 -0
- package/dist/assert.d.cts +2 -2
- package/dist/assert.d.ts +2 -2
- package/dist/expect.types-CHYPdbCW.d.cts +454 -0
- package/dist/expect.types-CHYPdbCW.d.cts.map +1 -0
- package/dist/expect.types-nBq4Rg8e.d.ts +454 -0
- package/dist/expect.types-nBq4Rg8e.d.ts.map +1 -0
- package/dist/expect.types.d.cts +2 -2
- package/dist/expect.types.d.ts +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{throws-BrCCeBBl.d.ts → throws-BlzO4xvg.d.ts} +5 -2
- package/dist/throws-BlzO4xvg.d.ts.map +1 -0
- package/dist/{throws-D7JsW4NM.d.cts → throws-CYLYG7gu.d.cts} +5 -2
- package/dist/throws-CYLYG7gu.d.cts.map +1 -0
- package/package.json +2 -1
- package/ESM_MIGRATION_NOTES.md +0 -6
- package/dist/assert-9EsvfQwn.d.cts.map +0 -1
- package/dist/assert-B_vcZS90.d.ts.map +0 -1
- package/dist/expect.types-DPl6xY56.d.ts +0 -99
- package/dist/expect.types-DPl6xY56.d.ts.map +0 -1
- package/dist/expect.types-s8icgWp5.d.cts +0 -99
- package/dist/expect.types-s8icgWp5.d.cts.map +0 -1
- package/dist/throws-BrCCeBBl.d.ts.map +0 -1
- package/dist/throws-D7JsW4NM.d.cts.map +0 -1
- package/eslint.config.mjs +0 -13
- package/tsdown.config.ts +0 -9
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Constructor, ErrorPredicate, notThrows, throws } from "./throws-
|
|
1
|
+
import { Constructor, ErrorPredicate, ValueType, notThrows, throws } from "./throws-CYLYG7gu.cjs";
|
|
2
2
|
|
|
3
|
+
//#region rolldown:runtime
|
|
4
|
+
//#endregion
|
|
3
5
|
//#region src/assert/deep-equal.d.ts
|
|
4
6
|
declare const deepEqual: <T>(actual: T, expected: T, partialOrMessage?: string | boolean, message?: string) => true | void, notDeepEqual: <T>(actual: T, expected: T, partialOrMessage?: string | boolean, message?: string) => true | void;
|
|
5
7
|
//#endregion
|
|
@@ -153,9 +155,6 @@ interface IsEmpty {
|
|
|
153
155
|
}
|
|
154
156
|
declare const isEmpty: IsEmpty, notIsEmpty: IsEmpty;
|
|
155
157
|
//#endregion
|
|
156
|
-
//#region src/utils/get-type.d.ts
|
|
157
|
-
type ValueType = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function' | 'null' | 'NaN' | 'array';
|
|
158
|
-
//#endregion
|
|
159
158
|
//#region src/assert/is-type.d.ts
|
|
160
159
|
interface IsType {
|
|
161
160
|
/**
|
|
@@ -477,5 +476,5 @@ declare namespace assert_d_exports {
|
|
|
477
476
|
}
|
|
478
477
|
declare const assert: () => never;
|
|
479
478
|
//#endregion
|
|
480
|
-
export {
|
|
481
|
-
//# sourceMappingURL=assert-
|
|
479
|
+
export { assert, assert_d_exports, deepEqual, deepHasProperty, deepNotHasProperty, endsWith, equal, greaterThan, greaterThanEqual, hasKeys, hasMembers, hasProperty, hasSize, inBallpark, includes, instanceOf, isAfter, isBefore, isBetween, isEmpty, isType, lessThan, lessThanEqual, match, notAfter, notBefore, notBetween, notDeepEqual, notEndsWith, notEqual, notGreaterThan, notGreaterThanEqual, notHasKeys, notHasMembers, notHasProperty, notHasSize, notInBallpark, notIncludes, notInstanceOf, notIsEmpty, notIsType, notLessThan, notLessThanEqual, notMatch, notRejects, notRoundTo, notStartsWith, rejects, roundTo, startsWith };
|
|
480
|
+
//# sourceMappingURL=assert-ChQPKP5C.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-ChQPKP5C.d.cts","names":[],"sources":["../src/assert/deep-equal.ts","../src/assert/equal.ts","../src/assert/greater-than.ts","../src/assert/greater-than-equal.ts","../src/assert/has-property.ts","../src/assert/has-size.ts","../src/assert/includes.ts","../src/assert/instance-of.ts","../src/assert/is-empty.ts","../src/assert/is-type.ts","../src/assert/less-than.ts","../src/assert/less-than-equal.ts","../src/assert/match.ts","../src/assert/rejects.ts","../src/assert/deep-has-property.ts","../src/assert/starts-with.ts","../src/assert/ends-with.ts","../src/assert/is-before.ts","../src/assert/is-after.ts","../src/assert/is-between.ts","../src/assert/in-ballpark.ts","../src/assert/round-to.ts","../src/assert/has-members.ts","../src/assert/has-keys.ts","../src/assert.ts"],"sourcesContent":[],"mappings":";;;;;cAIc,uBAOM,aAAa,oGAAb,aAAa;;;UCTvB,KAAA;;;;cAIM,aAAa;;cAGf,OAAK,iBAAU;;;UCNnB,WAAA;;;;+BAIuB,cAAc,aAAa;;cAG9C,aAAW,6BAAgB;;;UCP/B,gBAAA;;;;+BAIuB,cAAc,aAAa;;cAG9C,kBAAgB,uCAAqB;;;UCRzC,WAAA;;;;;;;sBAOc,WAAW,aAAa;;;;;;;;EJLlC,CAAA,CAAA,EAAA,UAOkF,MIMxE,CJNwE,CAAA,CAAA,MAAA,EIM7D,CJN6D,EAAA,QAAA,EIMhD,CJNgD,EAAA,KAAA,EIMtC,CJNsC,CIMpC,CJNoC,CAAA,CAAA,EAAA,IAAA;;AAA5E,cISN,WJTM,EISK,WJTL,EAAA,cAAA,EISqB,WJTrB;;;UKRV,OAAA;;;;;;;;;;;;;;WAcG;ELbC;;;;;;EAOoB,CAAA,GAAA,EKaxB,GLbwB,CAAA,OAAA,EAAA,OAAA,CAAA,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;EAPT;;;;;;MC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cAG5B,SAAO,mBAAU;;;UCPrB,gBAAA;;;UAIA,SAAA;;;;aAIK,cAAc,UAAU,QAAQ,aAAa;6BAC7B,UAAU,QAAQ,aAAa;;cAGhD,WAAS,uBAAY;;;UCZzB,UAAA;;;;;;;;;;;cAYI,YAAU,2BAAe;;;UCZ7B,OAAA;;;;;;;;;;cAWI,SAAO,qBAAY;;;UCVvB,iBAAA;;;;;;;;;;;;;;;EtBCI,OAAA,CAAA,EAAA,OAOkF;EAAA;;;;;;;;;;;;;;;ECFlF,OAAA,CAAK,EAAA,OAAA;;UqB4BT,UAAA,CrB5BS;;;;;;;;ECNE,CAAA,CAAA,CAAA,CAAA,MAAA,EoB0CL,CpB1CK,EAAA,EAAA,QAAA,EoB0CU,CpB1CV,EAAA,EAAA,OAAA,CAAA,EoB0CyB,iBpB1CzB,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;AAI0B,coByCjC,UpBzCiC,EoByCvB,UpBzCuB,EAAA,aAAA,EoByCR,UpBzCQ;;;UqBJrC,OAAA;;;;;;;;aAQK,qCAAqC,WAAW,SAAS,MAAM;gBAC5D,IAAI,iBAAiB,SAAS,MAAM;;cAGxC,SAAO,qBAAY;;;;cCWpB"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Constructor, ErrorPredicate, notThrows, throws } from "./throws-
|
|
1
|
+
import { Constructor, ErrorPredicate, ValueType, notThrows, throws } from "./throws-BlzO4xvg.js";
|
|
2
2
|
|
|
3
|
-
//#region rolldown:runtime
|
|
4
|
-
//#endregion
|
|
5
3
|
//#region src/assert/deep-equal.d.ts
|
|
6
4
|
declare const deepEqual: <T>(actual: T, expected: T, partialOrMessage?: string | boolean, message?: string) => true | void, notDeepEqual: <T>(actual: T, expected: T, partialOrMessage?: string | boolean, message?: string) => true | void;
|
|
7
5
|
//#endregion
|
|
@@ -155,9 +153,6 @@ interface IsEmpty {
|
|
|
155
153
|
}
|
|
156
154
|
declare const isEmpty: IsEmpty, notIsEmpty: IsEmpty;
|
|
157
155
|
//#endregion
|
|
158
|
-
//#region src/utils/get-type.d.ts
|
|
159
|
-
type ValueType = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function' | 'null' | 'NaN' | 'array';
|
|
160
|
-
//#endregion
|
|
161
156
|
//#region src/assert/is-type.d.ts
|
|
162
157
|
interface IsType {
|
|
163
158
|
/**
|
|
@@ -479,5 +474,5 @@ declare namespace assert_d_exports {
|
|
|
479
474
|
}
|
|
480
475
|
declare const assert: () => never;
|
|
481
476
|
//#endregion
|
|
482
|
-
export {
|
|
483
|
-
//# sourceMappingURL=assert-
|
|
477
|
+
export { assert, assert_d_exports, deepEqual, deepHasProperty, deepNotHasProperty, endsWith, equal, greaterThan, greaterThanEqual, hasKeys, hasMembers, hasProperty, hasSize, inBallpark, includes, instanceOf, isAfter, isBefore, isBetween, isEmpty, isType, lessThan, lessThanEqual, match, notAfter, notBefore, notBetween, notDeepEqual, notEndsWith, notEqual, notGreaterThan, notGreaterThanEqual, notHasKeys, notHasMembers, notHasProperty, notHasSize, notInBallpark, notIncludes, notInstanceOf, notIsEmpty, notIsType, notLessThan, notLessThanEqual, notMatch, notRejects, notRoundTo, notStartsWith, rejects, roundTo, startsWith };
|
|
478
|
+
//# sourceMappingURL=assert-CsN7srt-.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-CsN7srt-.d.ts","names":[],"sources":["../src/assert/deep-equal.ts","../src/assert/equal.ts","../src/assert/greater-than.ts","../src/assert/greater-than-equal.ts","../src/assert/has-property.ts","../src/assert/has-size.ts","../src/assert/includes.ts","../src/assert/instance-of.ts","../src/assert/is-empty.ts","../src/assert/is-type.ts","../src/assert/less-than.ts","../src/assert/less-than-equal.ts","../src/assert/match.ts","../src/assert/rejects.ts","../src/assert/deep-has-property.ts","../src/assert/starts-with.ts","../src/assert/ends-with.ts","../src/assert/is-before.ts","../src/assert/is-after.ts","../src/assert/is-between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EAAA,MAAA,CAAA,EAAA,IAAA;;AAAc,cqBEpB,OrBFoB,EqBEb,OrBFa,EAAA,UAAA,EqBED,OrBFC;;;UsBRxB,iBAAA;;;;AtBCV;;;MAOiC,CAAA,EAAA,OAAA;;;;;;;;ECTvB,OAAA,CAAK,EAAA,OAAA;EAAA;;;;AAOf;;;MAA6B,CAAA,EAAA,OAAA;EAgB3B;;;;;;;SClB+B,CAAA,EAAA,OAAA;;UoB8BvB,UAAA,CpB9BkD;EAAC;AAG7D;;;;;;coBmCgB,eAAe,eAAe;;cAGhC,YAAU,2BAAe;;;UC7C7B,OAAA;;;;AvBCV;;;;auBOe,MvBAK,CAAA,MAAA,EAAA,GAAA,CAAA,EAAA,UAAA,MuBAgC,CvBAhC,CAAA,CAAA,MAAA,EuBA2C,CvBA3C,EAAA,IAAA,EuBAoD,CvBApD,EAAA,GuBA0D,CvBA1D,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;MAAa,UuBCf,GvBDe,CuBCX,CvBDW,EAAA,GAAA,CAAA,CAAA,CAAA,MAAA,EuBCM,CvBDN,EAAA,IAAA,EuBCe,CvBDf,EAAA,GuBCqB,CvBDrB,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;AAPR,cuBWX,OvBXW,EuBWJ,OvBXI,EAAA,UAAA,EuBWQ,OvBXR;AAAA;;;ACKJ,cuBiBR,MvBjBQ,EAAA,GAAA,GAAA,KAAA"}
|
package/dist/assert.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { assert, deepEqual, deepHasProperty, deepNotHasProperty, endsWith, equal, greaterThan, greaterThanEqual, hasKeys, hasMembers, hasProperty, hasSize, inBallpark, includes, instanceOf, isAfter, isBefore, isBetween, isEmpty, isType, lessThan, lessThanEqual, match, notAfter, notBefore, notBetween, notDeepEqual, notEndsWith, notEqual, notGreaterThan, notGreaterThanEqual, notHasKeys, notHasMembers, notHasProperty, notHasSize, notInBallpark, notIncludes, notInstanceOf, notIsEmpty, notIsType, notLessThan, notLessThanEqual, notMatch, notRejects, notRoundTo, notStartsWith, rejects, roundTo, startsWith } from "./assert-
|
|
2
|
-
import { notThrows, throws } from "./throws-
|
|
1
|
+
import { assert, deepEqual, deepHasProperty, deepNotHasProperty, endsWith, equal, greaterThan, greaterThanEqual, hasKeys, hasMembers, hasProperty, hasSize, inBallpark, includes, instanceOf, isAfter, isBefore, isBetween, isEmpty, isType, lessThan, lessThanEqual, match, notAfter, notBefore, notBetween, notDeepEqual, notEndsWith, notEqual, notGreaterThan, notGreaterThanEqual, notHasKeys, notHasMembers, notHasProperty, notHasSize, notInBallpark, notIncludes, notInstanceOf, notIsEmpty, notIsType, notLessThan, notLessThanEqual, notMatch, notRejects, notRoundTo, notStartsWith, rejects, roundTo, startsWith } from "./assert-ChQPKP5C.cjs";
|
|
2
|
+
import { notThrows, throws } from "./throws-CYLYG7gu.cjs";
|
|
3
3
|
export { assert, deepEqual, deepHasProperty, deepNotHasProperty, endsWith, equal, greaterThan, greaterThanEqual, hasKeys, hasMembers, hasProperty, hasSize, inBallpark, includes, instanceOf, isAfter, isBefore, isBetween, isEmpty, isType, lessThan, lessThanEqual, match, notAfter, notBefore, notBetween, notDeepEqual, notEndsWith, notEqual, notGreaterThan, notGreaterThanEqual, notHasKeys, notHasMembers, notHasProperty, notHasSize, notInBallpark, notIncludes, notInstanceOf, notIsEmpty, notIsType, notLessThan, notLessThanEqual, notMatch, notRejects, notRoundTo, notStartsWith, notThrows, rejects, roundTo, startsWith, throws };
|
package/dist/assert.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { assert, deepEqual, deepHasProperty, deepNotHasProperty, endsWith, equal, greaterThan, greaterThanEqual, hasKeys, hasMembers, hasProperty, hasSize, inBallpark, includes, instanceOf, isAfter, isBefore, isBetween, isEmpty, isType, lessThan, lessThanEqual, match, notAfter, notBefore, notBetween, notDeepEqual, notEndsWith, notEqual, notGreaterThan, notGreaterThanEqual, notHasKeys, notHasMembers, notHasProperty, notHasSize, notInBallpark, notIncludes, notInstanceOf, notIsEmpty, notIsType, notLessThan, notLessThanEqual, notMatch, notRejects, notRoundTo, notStartsWith, rejects, roundTo, startsWith } from "./assert-
|
|
2
|
-
import { notThrows, throws } from "./throws-
|
|
1
|
+
import { assert, deepEqual, deepHasProperty, deepNotHasProperty, endsWith, equal, greaterThan, greaterThanEqual, hasKeys, hasMembers, hasProperty, hasSize, inBallpark, includes, instanceOf, isAfter, isBefore, isBetween, isEmpty, isType, lessThan, lessThanEqual, match, notAfter, notBefore, notBetween, notDeepEqual, notEndsWith, notEqual, notGreaterThan, notGreaterThanEqual, notHasKeys, notHasMembers, notHasProperty, notHasSize, notInBallpark, notIncludes, notInstanceOf, notIsEmpty, notIsType, notLessThan, notLessThanEqual, notMatch, notRejects, notRoundTo, notStartsWith, rejects, roundTo, startsWith } from "./assert-CsN7srt-.js";
|
|
2
|
+
import { notThrows, throws } from "./throws-BlzO4xvg.js";
|
|
3
3
|
export { assert, deepEqual, deepHasProperty, deepNotHasProperty, endsWith, equal, greaterThan, greaterThanEqual, hasKeys, hasMembers, hasProperty, hasSize, inBallpark, includes, instanceOf, isAfter, isBefore, isBetween, isEmpty, isType, lessThan, lessThanEqual, match, notAfter, notBefore, notBetween, notDeepEqual, notEndsWith, notEqual, notGreaterThan, notGreaterThanEqual, notHasKeys, notHasMembers, notHasProperty, notHasSize, notInBallpark, notIncludes, notInstanceOf, notIsEmpty, notIsType, notLessThan, notLessThanEqual, notMatch, notRejects, notRoundTo, notStartsWith, notThrows, rejects, roundTo, startsWith, throws };
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { Constructor, ErrorPredicate, ThrowsCallback, ValueType } from "./throws-CYLYG7gu.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/fail.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Throw an AssertionError
|
|
7
|
+
* @param {string} message - The message to pass to the AssertionError
|
|
8
|
+
*/
|
|
9
|
+
declare const fail: (message?: string) => never;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/utils/types.d.ts
|
|
12
|
+
type DeepPartial<T> = { [P in keyof T]?: T[P] | (T[P] extends Array<infer U> ? Array<DeepPartial<U>> : DeepPartial<T[P]>) };
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/mixins.d.ts
|
|
15
|
+
interface State<T> {
|
|
16
|
+
inverted?: boolean;
|
|
17
|
+
value?: T;
|
|
18
|
+
getProperty?: (value: T) => any;
|
|
19
|
+
deep?: boolean;
|
|
20
|
+
same?: boolean;
|
|
21
|
+
ordered?: boolean;
|
|
22
|
+
partial?: boolean;
|
|
23
|
+
every?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface Property {
|
|
26
|
+
type: 'property';
|
|
27
|
+
value: (state: State<any>) => Partial<State<any>> | null;
|
|
28
|
+
}
|
|
29
|
+
type MethodCallback = (state: State<any>) => (...args: any[]) => void;
|
|
30
|
+
interface Method {
|
|
31
|
+
type: 'method';
|
|
32
|
+
value: MethodCallback;
|
|
33
|
+
}
|
|
34
|
+
interface Alias {
|
|
35
|
+
type: 'alias';
|
|
36
|
+
value: string;
|
|
37
|
+
}
|
|
38
|
+
declare const use: (plugins: Record<string, Property | Method | Alias>) => void;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/expect.types.d.ts
|
|
41
|
+
interface ValueExpect<T> {
|
|
42
|
+
to: this;
|
|
43
|
+
be: this;
|
|
44
|
+
a: this;
|
|
45
|
+
an: this;
|
|
46
|
+
not: this;
|
|
47
|
+
and: this;
|
|
48
|
+
have: this;
|
|
49
|
+
in: this;
|
|
50
|
+
of: this;
|
|
51
|
+
/**
|
|
52
|
+
* Use deep equality for object checks
|
|
53
|
+
*/
|
|
54
|
+
deep: this;
|
|
55
|
+
/**
|
|
56
|
+
* check for deep equality
|
|
57
|
+
*/
|
|
58
|
+
eql(value: T, message?: string): this;
|
|
59
|
+
partially: ValueExpect<DeepPartial<T>>;
|
|
60
|
+
/**
|
|
61
|
+
* check for === equality, NaN is considered equal to NaN
|
|
62
|
+
*/
|
|
63
|
+
equal(value: T, message?: string): this;
|
|
64
|
+
/**
|
|
65
|
+
* check for === equality, NaN is considered equal to NaN
|
|
66
|
+
*/
|
|
67
|
+
eq(value: T, message?: string): this;
|
|
68
|
+
/**
|
|
69
|
+
* check if value has a property
|
|
70
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
71
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
72
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
73
|
+
*/
|
|
74
|
+
property<K extends keyof T>(property: K): this;
|
|
75
|
+
/**
|
|
76
|
+
* check if value has a property
|
|
77
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
78
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
79
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
80
|
+
*/
|
|
81
|
+
property(property: string): this;
|
|
82
|
+
/**
|
|
83
|
+
* check if value has a property
|
|
84
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
85
|
+
* @param value
|
|
86
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
87
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
88
|
+
*/
|
|
89
|
+
property<K extends keyof T>(property: K, value?: any): this;
|
|
90
|
+
/**
|
|
91
|
+
* check if value has a property
|
|
92
|
+
* @param property a property in the object. When combined with .deep. can be a path like 'a.b.c'
|
|
93
|
+
* @param value
|
|
94
|
+
* @example expect({a: {b: {c: 1}}}).to.have.property('a.b.c');
|
|
95
|
+
* @example expect({a: {b: {c: 1}}}).to.have.deep.property('[0].a.b.c');
|
|
96
|
+
*/
|
|
97
|
+
property(property: string, value?: any): this;
|
|
98
|
+
/**
|
|
99
|
+
* check if instance of value
|
|
100
|
+
* @param constructor - The constructor function to check against
|
|
101
|
+
*/
|
|
102
|
+
instanceOf(constructor: Constructor): this;
|
|
103
|
+
/**
|
|
104
|
+
* check if value is null
|
|
105
|
+
*/
|
|
106
|
+
null(): this;
|
|
107
|
+
/**
|
|
108
|
+
* check if value is undefined
|
|
109
|
+
*/
|
|
110
|
+
undefined(): this;
|
|
111
|
+
/**
|
|
112
|
+
* check if value is of certain type
|
|
113
|
+
*/
|
|
114
|
+
type(type: ValueType): this;
|
|
115
|
+
}
|
|
116
|
+
type ArrayType<T, DT = never> = T extends (infer U)[] ? U : DT;
|
|
117
|
+
interface ArrayExpect<T> extends ValueExpect<T>, ObjectExpect<T> {
|
|
118
|
+
length: NumberExpect<number> & this;
|
|
119
|
+
array(): this;
|
|
120
|
+
every: GetExpectType<ArrayType<T>>;
|
|
121
|
+
/**
|
|
122
|
+
* check if array includes element(s)
|
|
123
|
+
*/
|
|
124
|
+
include(...elements: ArrayType<T>[]): this;
|
|
125
|
+
/**
|
|
126
|
+
* check if array includes element(s)
|
|
127
|
+
*/
|
|
128
|
+
contain(...elements: ArrayType<T>[]): this;
|
|
129
|
+
/**
|
|
130
|
+
* check for array length
|
|
131
|
+
*/
|
|
132
|
+
lengthOf(length: number, message?: string): this;
|
|
133
|
+
/**
|
|
134
|
+
* check that the members in second array are present in the first one
|
|
135
|
+
*/
|
|
136
|
+
members(value: ArrayType<T, any>[], message?: string): this;
|
|
137
|
+
same: ArrayExpect<T>;
|
|
138
|
+
ordered: ArrayExpect<T>;
|
|
139
|
+
/**
|
|
140
|
+
* Use partial matching for objects
|
|
141
|
+
* @example
|
|
142
|
+
* expect({ a: 1, b: 2 }).to.partially.eql({ a: 1 });
|
|
143
|
+
*/
|
|
144
|
+
partially: ArrayExpect<DeepPartial<T>>;
|
|
145
|
+
/**
|
|
146
|
+
* check if value is an array
|
|
147
|
+
*/
|
|
148
|
+
array(): this;
|
|
149
|
+
}
|
|
150
|
+
interface BigIntExpect<T = bigint> extends NumberExpect<T> {
|
|
151
|
+
/**
|
|
152
|
+
* check if value is a bigint
|
|
153
|
+
*/
|
|
154
|
+
bigint(): this;
|
|
155
|
+
}
|
|
156
|
+
interface BooleanExpect<T = boolean> extends ValueExpect<T> {
|
|
157
|
+
/**
|
|
158
|
+
* check if value is a boolean
|
|
159
|
+
*/
|
|
160
|
+
boolean(): this;
|
|
161
|
+
}
|
|
162
|
+
interface DateExpect<T = Date> extends ValueExpect<T>, ObjectExpect<T> {
|
|
163
|
+
/**
|
|
164
|
+
* check if date is after other date
|
|
165
|
+
* @param date
|
|
166
|
+
*/
|
|
167
|
+
after(date: Date): this;
|
|
168
|
+
/**
|
|
169
|
+
* check if date is before other date
|
|
170
|
+
* @param date
|
|
171
|
+
*/
|
|
172
|
+
before(date: Date): this;
|
|
173
|
+
/**
|
|
174
|
+
* check if date is between other dates
|
|
175
|
+
* @param start
|
|
176
|
+
* @param end
|
|
177
|
+
*/
|
|
178
|
+
between(start: Date, end: Date, inclusive?: boolean): this;
|
|
179
|
+
/**
|
|
180
|
+
* check if actual is greater than or equal to expected
|
|
181
|
+
*/
|
|
182
|
+
greaterThanOrEqual(value: T): this;
|
|
183
|
+
/**
|
|
184
|
+
* check if actual is greater than or equal to expected
|
|
185
|
+
*/
|
|
186
|
+
gte(value: T): this;
|
|
187
|
+
/**
|
|
188
|
+
* check if actual is greater than or equal to expected
|
|
189
|
+
*/
|
|
190
|
+
atLeast(value: T): this;
|
|
191
|
+
/**
|
|
192
|
+
* check if actual is greater than expected
|
|
193
|
+
*/
|
|
194
|
+
greaterThan(value: T): this;
|
|
195
|
+
/**
|
|
196
|
+
* check if actual is greater than expected
|
|
197
|
+
*/
|
|
198
|
+
gt(value: T): this;
|
|
199
|
+
/**
|
|
200
|
+
* check if actual is greater than expected
|
|
201
|
+
*/
|
|
202
|
+
above(value: T): this;
|
|
203
|
+
/**
|
|
204
|
+
* check if value is an instance of Date
|
|
205
|
+
*/
|
|
206
|
+
Date(): this;
|
|
207
|
+
/**
|
|
208
|
+
* check if actual is less than or equal to expected
|
|
209
|
+
*/
|
|
210
|
+
lessThanOrEqual(value: T): this;
|
|
211
|
+
/**
|
|
212
|
+
* check if actual is less than or equal to expected
|
|
213
|
+
*/
|
|
214
|
+
lte(value: T): this;
|
|
215
|
+
/**
|
|
216
|
+
* check if actual is less than or equal to expected
|
|
217
|
+
*/
|
|
218
|
+
atMost(value: T): this;
|
|
219
|
+
/**
|
|
220
|
+
* check if actual is less than expected
|
|
221
|
+
*/
|
|
222
|
+
lessThan(value: T): this;
|
|
223
|
+
/**
|
|
224
|
+
* check if actual is less than expected
|
|
225
|
+
*/
|
|
226
|
+
lt(value: T): this;
|
|
227
|
+
/**
|
|
228
|
+
* check if actual is less than expected
|
|
229
|
+
*/
|
|
230
|
+
below(value: T): this;
|
|
231
|
+
}
|
|
232
|
+
interface FunctionExpect<T> extends ValueExpect<T> {
|
|
233
|
+
/**
|
|
234
|
+
* check if function throws
|
|
235
|
+
* @param message
|
|
236
|
+
*/
|
|
237
|
+
throw(message?: string): this;
|
|
238
|
+
throw(matcher: RegExp | Constructor<Error> | ErrorPredicate, message?: string): this;
|
|
239
|
+
/**
|
|
240
|
+
* check if value is a function
|
|
241
|
+
*/
|
|
242
|
+
function(): this;
|
|
243
|
+
}
|
|
244
|
+
interface NumberExpect<T = number> extends ValueExpect<T> {
|
|
245
|
+
/**
|
|
246
|
+
* check if number close enough (default 10%)
|
|
247
|
+
* @param ballpark
|
|
248
|
+
* @param [multiplier=10] - a number between 0 and 1 (exclusive). 0.1 (default) means 10% difference is allowed.
|
|
249
|
+
*/
|
|
250
|
+
ballpark(ballpark: number, multiplier?: number): this;
|
|
251
|
+
/**
|
|
252
|
+
* check if number is between other numbers
|
|
253
|
+
* @param start
|
|
254
|
+
* @param end
|
|
255
|
+
* @param inclusive
|
|
256
|
+
*/
|
|
257
|
+
between(start: number, end: number, inclusive?: boolean): this;
|
|
258
|
+
/**
|
|
259
|
+
* check if actual is greater than or equal to expected
|
|
260
|
+
*/
|
|
261
|
+
greaterThanOrEqual(value: T): this;
|
|
262
|
+
/**
|
|
263
|
+
* check if actual is greater than or equal to expected
|
|
264
|
+
*/
|
|
265
|
+
gte(value: T): this;
|
|
266
|
+
/**
|
|
267
|
+
* check if actual is greater than or equal to expected
|
|
268
|
+
*/
|
|
269
|
+
atLeast(value: T): this;
|
|
270
|
+
/**
|
|
271
|
+
* check if actual is greater than expected
|
|
272
|
+
*/
|
|
273
|
+
greaterThan(value: T): this;
|
|
274
|
+
/**
|
|
275
|
+
* check if actual is greater than expected
|
|
276
|
+
*/
|
|
277
|
+
gt(value: T): this;
|
|
278
|
+
/**
|
|
279
|
+
* check if actual is greater than expected
|
|
280
|
+
*/
|
|
281
|
+
above(value: T): this;
|
|
282
|
+
/**
|
|
283
|
+
* check if actual is less than or equal to expected
|
|
284
|
+
*/
|
|
285
|
+
lessThanOrEqual(value: T): this;
|
|
286
|
+
/**
|
|
287
|
+
* check if actual is less than or equal to expected
|
|
288
|
+
*/
|
|
289
|
+
lte(value: T): this;
|
|
290
|
+
/**
|
|
291
|
+
* check if actual is less than or equal to expected
|
|
292
|
+
*/
|
|
293
|
+
atMost(value: T): this;
|
|
294
|
+
/**
|
|
295
|
+
* check if actual is less than expected
|
|
296
|
+
*/
|
|
297
|
+
lessThan(value: T): this;
|
|
298
|
+
/**
|
|
299
|
+
* check if actual is less than expected
|
|
300
|
+
*/
|
|
301
|
+
lt(value: T): this;
|
|
302
|
+
/**
|
|
303
|
+
* check if actual is less than expected
|
|
304
|
+
*/
|
|
305
|
+
below(value: T): this;
|
|
306
|
+
/**
|
|
307
|
+
* check if number close enough (default 10%)
|
|
308
|
+
* @param target
|
|
309
|
+
* @param decimal defaults to 0, can be negative if trying to round down to nearest 10, 100, etc
|
|
310
|
+
*/
|
|
311
|
+
roundTo(target: number, decimal?: number): this;
|
|
312
|
+
/**
|
|
313
|
+
* check if value is a number
|
|
314
|
+
*/
|
|
315
|
+
number(): this;
|
|
316
|
+
/**
|
|
317
|
+
* check if value is a NaN
|
|
318
|
+
*/
|
|
319
|
+
NaN(): this;
|
|
320
|
+
}
|
|
321
|
+
type InferMapKeys<T> = T extends Map<infer K, any> ? K : never;
|
|
322
|
+
interface MapExpect<T> extends ValueExpect<T> {
|
|
323
|
+
size: NumberExpect<number>;
|
|
324
|
+
/**
|
|
325
|
+
* check if Map is empty
|
|
326
|
+
*/
|
|
327
|
+
empty(message?: string): this;
|
|
328
|
+
/**
|
|
329
|
+
* check if value is an instance of Map
|
|
330
|
+
*/
|
|
331
|
+
Map(): this;
|
|
332
|
+
/**
|
|
333
|
+
* Check if value has keys
|
|
334
|
+
*/
|
|
335
|
+
keys<K extends InferMapKeys<T>>(keys: K[] | K): this;
|
|
336
|
+
/**
|
|
337
|
+
* check for Map to have a certain size
|
|
338
|
+
*/
|
|
339
|
+
sizeOf(size: number, message?: string): this;
|
|
340
|
+
}
|
|
341
|
+
interface ObjectExpect<T> extends ValueExpect<T> {
|
|
342
|
+
size: NumberExpect<number>;
|
|
343
|
+
/**
|
|
344
|
+
* check if object/array/Map/Set is empty
|
|
345
|
+
*/
|
|
346
|
+
empty(message?: string): this;
|
|
347
|
+
/**
|
|
348
|
+
* exclude keys from object to be compared further down the chain
|
|
349
|
+
* @param keys
|
|
350
|
+
*/
|
|
351
|
+
excluding<K extends keyof T>(...keys: K[]): ObjectExpect<Omit<T, K>>;
|
|
352
|
+
/**
|
|
353
|
+
* check if value is an instance of Map
|
|
354
|
+
*/
|
|
355
|
+
Map(): this;
|
|
356
|
+
/**
|
|
357
|
+
* check if value is an instance of Set
|
|
358
|
+
*/
|
|
359
|
+
Set(): this;
|
|
360
|
+
/**
|
|
361
|
+
* check if value is an instance of WeakMap
|
|
362
|
+
*/
|
|
363
|
+
WeakMap(): this;
|
|
364
|
+
/**
|
|
365
|
+
* check if value is an instance of WeakSet
|
|
366
|
+
*/
|
|
367
|
+
WeakSet(): this;
|
|
368
|
+
/**
|
|
369
|
+
* Check if value has keys
|
|
370
|
+
*/
|
|
371
|
+
keys<K extends keyof T>(keys: K[] | K): this;
|
|
372
|
+
/**
|
|
373
|
+
* check for object/array/Map/Set/string to have a certain size
|
|
374
|
+
*/
|
|
375
|
+
sizeOf(size: number, message?: string): this;
|
|
376
|
+
/**
|
|
377
|
+
* check if value is a plain object
|
|
378
|
+
*/
|
|
379
|
+
object(): this;
|
|
380
|
+
}
|
|
381
|
+
interface PromiseExpect<T> extends ValueExpect<T> {
|
|
382
|
+
/**
|
|
383
|
+
* check if promise rejects
|
|
384
|
+
* @param message
|
|
385
|
+
*/
|
|
386
|
+
reject(message?: string): Promise<void>;
|
|
387
|
+
reject(matcher: RegExp | Constructor<Error> | ErrorPredicate): Promise<void>;
|
|
388
|
+
}
|
|
389
|
+
interface StringExpect<T = string> extends ValueExpect<T> {
|
|
390
|
+
/**
|
|
391
|
+
* check if string ends with other string
|
|
392
|
+
* @param start
|
|
393
|
+
* @example endsWith('foo', 'o');
|
|
394
|
+
*/
|
|
395
|
+
endWith(end: string): this;
|
|
396
|
+
/**
|
|
397
|
+
* check if string includes substring(s)
|
|
398
|
+
*/
|
|
399
|
+
include(...substrings: string[]): this;
|
|
400
|
+
/**
|
|
401
|
+
* check if string includes substring(s)
|
|
402
|
+
*/
|
|
403
|
+
contain(...substrings: string[]): this;
|
|
404
|
+
/**
|
|
405
|
+
* check for string to have a certain size
|
|
406
|
+
*/
|
|
407
|
+
lengthOf(length: number, message?: string): this;
|
|
408
|
+
/**
|
|
409
|
+
* check if string matches regex
|
|
410
|
+
*/
|
|
411
|
+
match(regex: RegExp): this;
|
|
412
|
+
/**
|
|
413
|
+
* check if string starts with other string
|
|
414
|
+
* @param start
|
|
415
|
+
* @example startsWith('foo', 'f');
|
|
416
|
+
*/
|
|
417
|
+
startWith(start: string): this;
|
|
418
|
+
/**
|
|
419
|
+
* check if value is a string
|
|
420
|
+
*/
|
|
421
|
+
string(): this;
|
|
422
|
+
}
|
|
423
|
+
interface SymbolExpect<T> extends ValueExpect<T> {
|
|
424
|
+
/**
|
|
425
|
+
* check if value is a symbol
|
|
426
|
+
*/
|
|
427
|
+
symbol(): this;
|
|
428
|
+
}
|
|
429
|
+
declare const LooseSymbol: unique symbol;
|
|
430
|
+
interface Loose {
|
|
431
|
+
[LooseSymbol]: true;
|
|
432
|
+
}
|
|
433
|
+
type AllExpects<T> = ArrayExpect<T> & BigIntExpect<T> & BooleanExpect<T> & DateExpect<T> & FunctionExpect<T> & NumberExpect<T> & MapExpect<T> & ObjectExpect<T> & PromiseExpect<T> & StringExpect<T> & SymbolExpect<T> & ValueExpect<T>;
|
|
434
|
+
interface Expect {
|
|
435
|
+
<T extends Loose>(actual: T): AllExpects<T>;
|
|
436
|
+
<T extends ThrowsCallback>(actual: T): FunctionExpect<T>;
|
|
437
|
+
<T extends Promise<any>>(actual: T): PromiseExpect<T>;
|
|
438
|
+
<T extends any[]>(actual: T): ArrayExpect<T>;
|
|
439
|
+
<T extends Date>(actual: T): DateExpect<T>;
|
|
440
|
+
<T extends Map<any, any>>(actual: T): MapExpect<T>;
|
|
441
|
+
<T extends Record<string, any>>(actual: T): ObjectExpect<T>;
|
|
442
|
+
<T extends number>(actual: T): NumberExpect;
|
|
443
|
+
<T extends bigint>(actual: T): BigIntExpect;
|
|
444
|
+
<T extends boolean>(actual: T): BooleanExpect;
|
|
445
|
+
<T extends string>(actual: T): StringExpect;
|
|
446
|
+
<T extends symbol>(actual: T): SymbolExpect<T>;
|
|
447
|
+
<T>(actual: T): ValueExpect<T>;
|
|
448
|
+
fail: typeof fail;
|
|
449
|
+
}
|
|
450
|
+
type GetExpectType<T> = T extends number ? NumberExpect<T> : AllExpects<T>;
|
|
451
|
+
//# sourceMappingURL=expect.types.d.ts.map
|
|
452
|
+
//#endregion
|
|
453
|
+
export { Alias, ArrayExpect, BigIntExpect, BooleanExpect, DateExpect, Expect, FunctionExpect, Loose, MapExpect, Method, NumberExpect, ObjectExpect, PromiseExpect, Property, type State, StringExpect, SymbolExpect, ValueExpect, fail, use };
|
|
454
|
+
//# sourceMappingURL=expect.types-CHYPdbCW.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect.types-CHYPdbCW.d.cts","names":[],"sources":["../src/utils/fail.ts","../src/utils/types.ts","../src/mixins.ts","../src/expect.types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAMA;cAAa;;;KCND,+BACI,KAAK,EAAE,MAAM,EAAE,WAAW,iBAAiB,MAAM,YAAY,MAAM,YAAY,EAAE;;;UCDhF;;UAEL;EFIC,WAEZ,CAAA,EAAA,CAAA,KAAA,EELyB,CFKzB,EAAA,GAAA,GAAA;;;;ECRW,OAAA,CAAA,EAAA,OAAW;EAAA,KAAA,CAAA,EAAA,OAAA;;AACF,UCWJ,QAAA,CDXI;MAAE,EAAA,UAAA;OAAM,EAAA,CAAA,KAAA,ECaV,KDbU,CAAA,GAAA,CAAA,EAAA,GCaK,ODbL,CCaa,KDbb,CAAA,GAAA,CAAA,CAAA,GAAA,IAAA;;KCgBxB,cAAA,GDhBqC,CAAA,KAAA,ECgBZ,KDhBY,CAAA,GAAA,CAAA,EAAA,GAAA,CAAA,GAAA,IAAA,EAAA,GAAA,EAAA,EAAA,GAAA,IAAA;AAAmC,UCkB5D,MAAA,CDlB4D;MAAZ,EAAA,QAAA;OAAN,ECoBhD,cDpBgD;;AAAsC,UCuBhF,KAAA,CDvBgF;MAAd,EAAA,OAAA;EAAW,KAAA,EAAA,MAAA;;cC8BjF,eAAgB,eAAe,WAAW,SAAS;;;UCxB/C;EFPL,EAAA,EAAA,IAAA;EAAW,EAAA,EAAA,IAAA;KACP,IAAA;MAAK,IAAA;KAAE,EAAA,IAAA;KAAM,EAAA,IAAA;MAAE,EAAA,IAAA;MAAW,IAAA;MAAmC,IAAA;;;;MAAoB,EAAA,IAAA;;;;aEuBlF;aACA,YAAY,YAAY;EDzBtB;;;OAGS,CAAA,KAAA,EC0BT,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