hein 0.0.1 → 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 +30 -0
- package/README.md +31 -4
- package/dist/.tsbuildinfo +1 -0
- package/dist/assert/deep-equal.d.ts +2 -0
- package/dist/assert/deep-equal.d.ts.map +1 -0
- package/dist/assert/{eql.js → deep-equal.js} +9 -7
- package/dist/assert/deep-equal.js.map +1 -0
- package/dist/assert/deep-equal.test.d.ts +2 -0
- package/dist/assert/deep-equal.test.d.ts.map +1 -0
- package/dist/assert/deep-equal.test.js +114 -0
- package/dist/assert/deep-equal.test.js.map +1 -0
- package/dist/assert/deep-has-property.d.ts +2 -0
- package/dist/assert/deep-has-property.d.ts.map +1 -0
- package/dist/assert/deep-has-property.js +30 -0
- package/dist/assert/deep-has-property.js.map +1 -0
- package/dist/assert/deep-has-property.test.d.ts +2 -0
- package/dist/assert/deep-has-property.test.d.ts.map +1 -0
- package/dist/assert/deep-has-property.test.js +40 -0
- package/dist/assert/deep-has-property.test.js.map +1 -0
- package/dist/assert/equal.js +2 -2
- package/dist/assert/equal.js.map +1 -1
- package/dist/assert/equal.test.d.ts +2 -0
- package/dist/assert/equal.test.d.ts.map +1 -0
- package/dist/assert/equal.test.js +57 -0
- package/dist/assert/equal.test.js.map +1 -0
- package/dist/assert/greater-than-equal.js +2 -2
- package/dist/assert/greater-than-equal.js.map +1 -1
- package/dist/assert/greater-than-equal.test.d.ts +2 -0
- package/dist/assert/greater-than-equal.test.d.ts.map +1 -0
- package/dist/assert/greater-than-equal.test.js +17 -0
- package/dist/assert/greater-than-equal.test.js.map +1 -0
- package/dist/assert/greater-than.js +2 -2
- package/dist/assert/greater-than.js.map +1 -1
- package/dist/assert/greater-than.test.d.ts +2 -0
- package/dist/assert/greater-than.test.d.ts.map +1 -0
- package/dist/assert/greater-than.test.js +31 -0
- package/dist/assert/greater-than.test.js.map +1 -0
- package/dist/assert/has-property.d.ts +2 -0
- package/dist/assert/has-property.d.ts.map +1 -0
- package/dist/assert/has-property.js +28 -0
- package/dist/assert/has-property.js.map +1 -0
- package/dist/assert/has-property.test.d.ts +2 -0
- package/dist/assert/has-property.test.d.ts.map +1 -0
- package/dist/assert/has-property.test.js +40 -0
- package/dist/assert/has-property.test.js.map +1 -0
- package/dist/assert/has-size.js +2 -2
- package/dist/assert/has-size.js.map +1 -1
- package/dist/assert/has-size.test.d.ts +2 -0
- package/dist/assert/has-size.test.d.ts.map +1 -0
- package/dist/assert/has-size.test.js +137 -0
- package/dist/assert/has-size.test.js.map +1 -0
- package/dist/assert/includes.d.ts +7 -0
- package/dist/assert/includes.d.ts.map +1 -0
- package/dist/assert/includes.js +32 -0
- package/dist/assert/includes.js.map +1 -0
- package/dist/assert/includes.test.d.ts +2 -0
- package/dist/assert/includes.test.d.ts.map +1 -0
- package/dist/assert/includes.test.js +45 -0
- package/dist/assert/includes.test.js.map +1 -0
- package/dist/assert/instance-of.js +3 -3
- package/dist/assert/instance-of.js.map +1 -1
- package/dist/assert/instance-of.test.d.ts +2 -0
- package/dist/assert/instance-of.test.d.ts.map +1 -0
- package/dist/assert/instance-of.test.js +24 -0
- package/dist/assert/instance-of.test.js.map +1 -0
- package/dist/assert/is-empty.js +2 -2
- package/dist/assert/is-empty.js.map +1 -1
- package/dist/assert/is-empty.test.d.ts +2 -0
- package/dist/assert/is-empty.test.d.ts.map +1 -0
- package/dist/assert/is-empty.test.js +76 -0
- package/dist/assert/is-empty.test.js.map +1 -0
- package/dist/assert/is-type.js +2 -2
- package/dist/assert/is-type.js.map +1 -1
- package/dist/assert/is-type.test.d.ts +2 -0
- package/dist/assert/is-type.test.d.ts.map +1 -0
- package/dist/assert/is-type.test.js +36 -0
- package/dist/assert/is-type.test.js.map +1 -0
- package/dist/assert/less-than-equal.js +2 -2
- package/dist/assert/less-than-equal.js.map +1 -1
- package/dist/assert/less-than-equal.test.d.ts +2 -0
- package/dist/assert/less-than-equal.test.d.ts.map +1 -0
- package/dist/assert/less-than-equal.test.js +51 -0
- package/dist/assert/less-than-equal.test.js.map +1 -0
- package/dist/assert/less-than.js +2 -2
- package/dist/assert/less-than.js.map +1 -1
- package/dist/assert/less-than.test.d.ts +2 -0
- package/dist/assert/less-than.test.d.ts.map +1 -0
- package/dist/assert/less-than.test.js +28 -0
- package/dist/assert/less-than.test.js.map +1 -0
- package/dist/assert/match.d.ts +2 -0
- package/dist/assert/match.d.ts.map +1 -0
- package/dist/assert/match.js +29 -0
- package/dist/assert/match.js.map +1 -0
- package/dist/assert/match.test.d.ts +2 -0
- package/dist/assert/match.test.d.ts.map +1 -0
- package/dist/assert/match.test.js +24 -0
- package/dist/assert/match.test.js.map +1 -0
- package/dist/assert/rejects.js +2 -2
- package/dist/assert/rejects.js.map +1 -1
- package/dist/assert/rejects.test.d.ts +2 -0
- package/dist/assert/rejects.test.d.ts.map +1 -0
- package/dist/assert/rejects.test.js +101 -0
- package/dist/assert/rejects.test.js.map +1 -0
- package/dist/assert/throws.js +3 -3
- package/dist/assert/throws.js.map +1 -1
- package/dist/assert/throws.test.d.ts +2 -0
- package/dist/assert/throws.test.d.ts.map +1 -0
- package/dist/assert/throws.test.js +154 -0
- package/dist/assert/throws.test.js.map +1 -0
- package/dist/assert.d.ts +5 -1
- package/dist/assert.d.ts.map +1 -1
- package/dist/assert.js +16 -4
- package/dist/assert.js.map +1 -1
- package/dist/expect/empty.test.d.ts +2 -0
- package/dist/expect/empty.test.d.ts.map +1 -0
- package/dist/expect/empty.test.js +24 -0
- package/dist/expect/empty.test.js.map +1 -0
- package/dist/expect/eql.d.ts +4 -0
- package/dist/expect/eql.d.ts.map +1 -1
- package/dist/expect/eql.js +7 -3
- package/dist/expect/eql.js.map +1 -1
- package/dist/expect/eql.test.d.ts +2 -0
- package/dist/expect/eql.test.d.ts.map +1 -0
- package/dist/expect/eql.test.js +28 -0
- package/dist/expect/eql.test.js.map +1 -0
- package/dist/expect/equal-shorthand.js +3 -3
- package/dist/expect/equal-shorthand.js.map +1 -1
- package/dist/expect/equal-shorthand.test.d.ts +2 -0
- package/dist/expect/equal-shorthand.test.d.ts.map +1 -0
- package/dist/expect/equal-shorthand.test.js +34 -0
- package/dist/expect/equal-shorthand.test.js.map +1 -0
- package/dist/expect/equal.js +10 -1
- package/dist/expect/equal.js.map +1 -1
- package/dist/expect/equal.test.d.ts +2 -0
- package/dist/expect/equal.test.d.ts.map +1 -0
- package/dist/expect/equal.test.js +30 -0
- package/dist/expect/equal.test.js.map +1 -0
- package/dist/expect/greater-than-equal.test.d.ts +2 -0
- package/dist/expect/greater-than-equal.test.d.ts.map +1 -0
- package/dist/expect/greater-than-equal.test.js +24 -0
- package/dist/expect/greater-than-equal.test.js.map +1 -0
- package/dist/expect/greater-than.test.d.ts +2 -0
- package/dist/expect/greater-than.test.d.ts.map +1 -0
- package/dist/expect/greater-than.test.js +24 -0
- package/dist/expect/greater-than.test.js.map +1 -0
- package/dist/expect/has-property.d.ts +7 -0
- package/dist/expect/has-property.d.ts.map +1 -0
- package/dist/expect/has-property.js +22 -0
- package/dist/expect/has-property.js.map +1 -0
- package/dist/expect/has-property.test.d.ts +2 -0
- package/dist/expect/has-property.test.d.ts.map +1 -0
- package/dist/expect/has-property.test.js +39 -0
- package/dist/expect/has-property.test.js.map +1 -0
- package/dist/expect/include.d.ts +25 -0
- package/dist/expect/include.d.ts.map +1 -0
- package/dist/expect/include.js +22 -0
- package/dist/expect/include.js.map +1 -0
- package/dist/expect/include.test.d.ts +2 -0
- package/dist/expect/include.test.d.ts.map +1 -0
- package/dist/expect/include.test.js +33 -0
- package/dist/expect/include.test.js.map +1 -0
- package/dist/expect/instance-of-shorthand.d.ts.map +1 -1
- package/dist/expect/instance-of-shorthand.test.d.ts +2 -0
- package/dist/expect/instance-of-shorthand.test.d.ts.map +1 -0
- package/dist/expect/instance-of-shorthand.test.js +42 -0
- package/dist/expect/instance-of-shorthand.test.js.map +1 -0
- package/dist/expect/instance-of.test.d.ts +2 -0
- package/dist/expect/instance-of.test.d.ts.map +1 -0
- package/dist/expect/instance-of.test.js +24 -0
- package/dist/expect/instance-of.test.js.map +1 -0
- package/dist/expect/length.test.d.ts +2 -0
- package/dist/expect/length.test.d.ts.map +1 -0
- package/dist/expect/length.test.js +24 -0
- package/dist/expect/length.test.js.map +1 -0
- package/dist/expect/less-than-equal.test.d.ts +2 -0
- package/dist/expect/less-than-equal.test.d.ts.map +1 -0
- package/dist/expect/less-than-equal.test.js +26 -0
- package/dist/expect/less-than-equal.test.js.map +1 -0
- package/dist/expect/less-than.test.d.ts +2 -0
- package/dist/expect/less-than.test.d.ts.map +1 -0
- package/dist/expect/less-than.test.js +26 -0
- package/dist/expect/less-than.test.js.map +1 -0
- package/dist/expect/match.d.ts +10 -0
- package/dist/expect/match.d.ts.map +1 -0
- package/dist/expect/match.js +18 -0
- package/dist/expect/match.js.map +1 -0
- package/dist/expect/match.test.d.ts +2 -0
- package/dist/expect/match.test.d.ts.map +1 -0
- package/dist/expect/match.test.js +24 -0
- package/dist/expect/match.test.js.map +1 -0
- package/dist/expect/reject.test.d.ts +2 -0
- package/dist/expect/reject.test.d.ts.map +1 -0
- package/dist/expect/reject.test.js +26 -0
- package/dist/expect/reject.test.js.map +1 -0
- package/dist/expect/throw.test.d.ts +2 -0
- package/dist/expect/throw.test.d.ts.map +1 -0
- package/dist/expect/throw.test.js +31 -0
- package/dist/expect/throw.test.js.map +1 -0
- package/dist/expect/type-shorthand.d.ts.map +1 -1
- package/dist/expect/type-shorthand.test.d.ts +2 -0
- package/dist/expect/type-shorthand.test.d.ts.map +1 -0
- package/dist/expect/type-shorthand.test.js +57 -0
- package/dist/expect/type-shorthand.test.js.map +1 -0
- package/dist/expect/type.test.d.ts +2 -0
- package/dist/expect/type.test.d.ts.map +1 -0
- package/dist/expect/type.test.js +24 -0
- package/dist/expect/type.test.js.map +1 -0
- package/dist/expect.d.ts +3 -0
- package/dist/expect.d.ts.map +1 -1
- package/dist/expect.js +20 -9
- package/dist/expect.js.map +1 -1
- package/dist/expect.test.d.ts +2 -0
- package/dist/expect.test.d.ts.map +1 -0
- package/dist/expect.test.js +19 -0
- package/dist/expect.test.js.map +1 -0
- package/dist/expect.types.d.ts +2 -1
- package/dist/expect.types.d.ts.map +1 -1
- package/dist/expect.types.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/mixins.d.ts +5 -3
- package/dist/mixins.d.ts.map +1 -1
- package/dist/mixins.js.map +1 -1
- package/dist/utils/get-size.test.d.ts +2 -0
- package/dist/utils/get-size.test.d.ts.map +1 -0
- package/dist/utils/get-size.test.js +25 -0
- package/dist/utils/get-size.test.js.map +1 -0
- package/dist/utils/match.test.d.ts +2 -0
- package/dist/utils/match.test.d.ts.map +1 -0
- package/dist/utils/match.test.js +318 -0
- package/dist/utils/match.test.js.map +1 -0
- package/dist/utils/process-error.d.ts +1 -1
- package/dist/utils/process-error.d.ts.map +1 -1
- package/dist/utils/validate-numeric-and-dates.js +2 -2
- package/dist/utils/validate-numeric-and-dates.js.map +1 -1
- package/package.json +26 -15
- package/.eslintrc +0 -167
- package/.mocharc.json +0 -4
- package/.nycrc +0 -16
- package/DIFFERENCES_WITH_CHAI.md +0 -49
- package/dist/assert/eql.d.ts +0 -2
- package/dist/assert/eql.d.ts.map +0 -1
- package/dist/assert/eql.js.map +0 -1
- package/dist/utils/assertion.d.ts +0 -25
- package/dist/utils/assertion.d.ts.map +0 -1
- package/dist/utils/assertion.js +0 -45
- package/dist/utils/assertion.js.map +0 -1
- package/dist/utils/stringify.d.ts +0 -2
- package/dist/utils/stringify.d.ts.map +0 -1
- package/dist/utils/stringify.js +0 -18
- package/dist/utils/stringify.js.map +0 -1
- package/tsconfig.json +0 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-property.d.ts","sourceRoot":"","sources":["../../src/expect/has-property.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,iBAAiB,CAAC;IAC7B,UAAU,WAAW,CAAC,CAAC;QACnB,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;KACxE;CACJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const assert_1 = require("../assert");
|
|
4
|
+
const mixins_1 = require("../mixins");
|
|
5
|
+
(0, mixins_1.use)({
|
|
6
|
+
property: {
|
|
7
|
+
type: 'method',
|
|
8
|
+
value: ({ value, inverted, deep }) => (...args) => {
|
|
9
|
+
if (deep) {
|
|
10
|
+
if (inverted) {
|
|
11
|
+
return (0, assert_1.deepNotHasProperty)(value, ...args);
|
|
12
|
+
}
|
|
13
|
+
return (0, assert_1.deepHasProperty)(value, ...args);
|
|
14
|
+
}
|
|
15
|
+
if (inverted) {
|
|
16
|
+
return (0, assert_1.notHasProperty)(value, ...args);
|
|
17
|
+
}
|
|
18
|
+
return (0, assert_1.hasProperty)(value, ...args);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=has-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-property.js","sourceRoot":"","sources":["../../src/expect/has-property.ts"],"names":[],"mappings":";;AAAA,sCAA6F;AAC7F,sCAAgC;AAQhC,IAAA,YAAG,EAAC;IACA,QAAQ,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,IAAgB,EAAE,EAAE;YAC1D,IAAI,IAAI,EAAE;gBACN,IAAI,QAAQ,EAAE;oBACV,OAAO,IAAA,2BAAkB,EAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;iBAC7C;gBACD,OAAO,IAAA,wBAAe,EAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;aAC1C;YACD,IAAI,QAAQ,EAAE;gBACV,OAAO,IAAA,uBAAc,EAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;aACzC;YACD,OAAO,IAAA,oBAAW,EAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QACvC,CAAC;KACJ;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-property.test.d.ts","sourceRoot":"","sources":["../../src/expect/has-property.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const expect_1 = require("../expect");
|
|
4
|
+
describe('expect/property', () => {
|
|
5
|
+
it('should not throw if object has property', () => {
|
|
6
|
+
(0, expect_1.expect)({ a: 1 }).to.have.property('a');
|
|
7
|
+
});
|
|
8
|
+
it('should throw if object has property but value is incorrect', () => {
|
|
9
|
+
(0, expect_1.expect)(() => {
|
|
10
|
+
(0, expect_1.expect)({ a: 1 }).to.have.property('a', 2);
|
|
11
|
+
}).to.throw(/Expected { a: 1 } to have property a with value 2/);
|
|
12
|
+
});
|
|
13
|
+
describe('not', () => {
|
|
14
|
+
it(`should not throw if object doesn't have property`, () => {
|
|
15
|
+
(0, expect_1.expect)({ a: 1 }).to.not.have.property('b');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
describe('deep', () => {
|
|
19
|
+
it('should not throw if object has deep property', () => {
|
|
20
|
+
(0, expect_1.expect)({ a: { b: { c: 1 } } }).to.have.deep.property('a.b.c', 1);
|
|
21
|
+
});
|
|
22
|
+
it('should throw if object has deep property but value is different', () => {
|
|
23
|
+
(0, expect_1.expect)(() => {
|
|
24
|
+
(0, expect_1.expect)({ a: { b: { c: 1 } } }).to.have.deep.property('a.b.c', 2);
|
|
25
|
+
}).to.throw(/Expected { a: { b: { c: 1 } } } to have property a.b.c with value 2/);
|
|
26
|
+
});
|
|
27
|
+
describe('not', () => {
|
|
28
|
+
it(`should not throw if object doesn't have deep property`, () => {
|
|
29
|
+
(0, expect_1.expect)({ a: { b: { c: 1 } } }).to.not.have.deep.property('d.e.f', 1);
|
|
30
|
+
});
|
|
31
|
+
it('should throw if object has deep property', () => {
|
|
32
|
+
(0, expect_1.expect)(() => {
|
|
33
|
+
(0, expect_1.expect)({ a: { b: { c: 1 } } }).to.not.have.deep.property('a.b.c', 1);
|
|
34
|
+
}).to.throw(/Expected { a: { b: { c: 1 } } } to not have property a.b.c with value 1/);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=has-property.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-property.test.js","sourceRoot":"","sources":["../../src/expect/has-property.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QAC/C,IAAA,eAAM,EAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QAClE,IAAA,eAAM,EAAC,GAAG,EAAE;YACR,IAAA,eAAM,EAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACjB,EAAE,C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,GAAG,EAAE;gBAChD,IAAA,eAAM,EAAC,GAAG,EAAE;oBACR,IAAA,eAAM,EAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;gBACzE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,yEAAyE,CAAC,CAAC;YAC3F,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare type ArrayType<T> = T extends (infer U)[] ? U : T;
|
|
2
|
+
declare module '../expect.types' {
|
|
3
|
+
interface ArrayExpect<T> {
|
|
4
|
+
/**
|
|
5
|
+
* check if array includes element(s)
|
|
6
|
+
*/
|
|
7
|
+
include(...elements: ArrayType<T>[]): this;
|
|
8
|
+
/**
|
|
9
|
+
* check if array includes element(s)
|
|
10
|
+
*/
|
|
11
|
+
contain(...elements: ArrayType<T>[]): this;
|
|
12
|
+
}
|
|
13
|
+
interface StringExpect<T> {
|
|
14
|
+
/**
|
|
15
|
+
* check if string includes substring(s)
|
|
16
|
+
*/
|
|
17
|
+
include(...substrings: string[]): this;
|
|
18
|
+
/**
|
|
19
|
+
* check if string includes substring(s)
|
|
20
|
+
*/
|
|
21
|
+
contain(...substrings: string[]): this;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=include.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../../src/expect/include.ts"],"names":[],"mappings":"AAGA,aAAK,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;AAElD,OAAO,QAAQ,iBAAiB,CAAC;IAC7B,UAAU,WAAW,CAAC,CAAC;QACnB;;WAEG;QACH,OAAO,CAAC,GAAG,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;QAC3C;;WAEG;QACH,OAAO,CAAC,GAAG,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;KAC9C;IACD,UAAU,YAAY,CAAC,CAAC;QACpB;;WAEG;QACH,OAAO,CAAC,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACvC;;WAEG;QACH,OAAO,CAAC,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;KAC1C;CACJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const assert_1 = require("../assert");
|
|
4
|
+
const mixins_1 = require("../mixins");
|
|
5
|
+
(0, mixins_1.use)({
|
|
6
|
+
include: {
|
|
7
|
+
type: 'method',
|
|
8
|
+
value: ({ value, inverted }) => (...elements) => {
|
|
9
|
+
if (inverted) {
|
|
10
|
+
(0, assert_1.notIncludes)(value, ...elements);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
(0, assert_1.includes)(value, ...elements);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
contain: {
|
|
18
|
+
type: 'alias',
|
|
19
|
+
value: 'include'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=include.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.js","sourceRoot":"","sources":["../../src/expect/include.ts"],"names":[],"mappings":";;AAAA,sCAAkD;AAClD,sCAAgC;AA2BhC,IAAA,YAAG,EAAC;IACA,OAAO,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,QAAe,EAAE,EAAE;YACnD,IAAI,QAAQ,EAAE;gBACV,IAAA,oBAAW,EAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,CAAC;aACnC;iBAAM;gBACH,IAAA,iBAAQ,EAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,CAAC;aAChC;QACL,CAAC;KACJ;IACD,OAAO,EAAE;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,SAAS;KACnB;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.test.d.ts","sourceRoot":"","sources":["../../src/expect/include.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const expect_1 = require("../expect");
|
|
4
|
+
describe('expect/include', () => {
|
|
5
|
+
describe('arrays', () => {
|
|
6
|
+
it('should not throw if element is in array', () => {
|
|
7
|
+
(0, expect_1.expect)([1, 2]).to.include(1);
|
|
8
|
+
});
|
|
9
|
+
it('should throw if element is not in array', () => {
|
|
10
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)([1, 2]).to.include(3)).to.throw(/Expected \[ 1, 2 ] to include 3/);
|
|
11
|
+
});
|
|
12
|
+
describe('not', () => {
|
|
13
|
+
it('should throw if element is in array', () => {
|
|
14
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)([1, 2]).not.to.include(1)).to.throw(/Expected \[ 1, 2 ] to not include 1/);
|
|
15
|
+
});
|
|
16
|
+
it('should not throw if element is not in array', () => {
|
|
17
|
+
(0, expect_1.expect)([1, 2]).not.to.include(3);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
describe('strings', () => {
|
|
22
|
+
it('should not throw if string includes value', () => {
|
|
23
|
+
(0, expect_1.expect)('abc').to.include('bc');
|
|
24
|
+
});
|
|
25
|
+
it('should throw if string does not include substring', () => {
|
|
26
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)('abc').to.include('ba')).to.throw(/Expected 'abc' to include 'ba'/);
|
|
27
|
+
});
|
|
28
|
+
it('should not throw when using .contain', () => {
|
|
29
|
+
(0, expect_1.expect)('abc').to.contain('bc');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=include.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.test.js","sourceRoot":"","sources":["../../src/expect/include.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC5B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YAC/C,IAAA,eAAM,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YAC/C,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,IAAA,eAAM,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAC3F,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;YACjB,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;gBAC3C,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,IAAA,eAAM,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;YACnG,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;gBACnD,IAAA,eAAM,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACjD,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YACzD,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAC5F,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC5C,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance-of-shorthand.d.ts","sourceRoot":"","sources":["../../src/expect/instance-of-shorthand.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,iBAAiB,CAAC;IAC7B,UAAU,UAAU;QAChB;;WAEG;QACH,IAAI,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"instance-of-shorthand.d.ts","sourceRoot":"","sources":["../../src/expect/instance-of-shorthand.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,iBAAiB,CAAC;IAC7B,UAAU,UAAU;QAChB;;WAEG;QACH,IAAI,IAAI,IAAI,CAAC;KAChB;IACD,UAAU,YAAY,CAAC,CAAC;QACpB;;WAEG;QACH,GAAG,IAAI,IAAI,CAAC;QACZ;;WAEG;QACH,GAAG,IAAI,IAAI,CAAC;QACZ;;WAEG;QACH,OAAO,IAAI,IAAI,CAAC;QAChB;;WAEG;QACH,OAAO,IAAI,IAAI,CAAC;KACnB;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance-of-shorthand.test.d.ts","sourceRoot":"","sources":["../../src/expect/instance-of-shorthand.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
4
|
+
/* eslint-disable mocha/no-setup-in-describe */
|
|
5
|
+
const expect_1 = require("../expect");
|
|
6
|
+
const instances = {
|
|
7
|
+
Date: new Date(),
|
|
8
|
+
Map: new Map(),
|
|
9
|
+
Set: new Set(),
|
|
10
|
+
WeakMap: new WeakMap(),
|
|
11
|
+
WeakSet: new WeakSet()
|
|
12
|
+
};
|
|
13
|
+
describe('expect/instanceOf shorthands', () => {
|
|
14
|
+
for (const [method, instance] of Object.entries(instances)) {
|
|
15
|
+
describe(method, () => {
|
|
16
|
+
// eslint-disable-next-line unicorn/new-for-builtins
|
|
17
|
+
const wrongInstance = new String();
|
|
18
|
+
it(`should not throw if value is an instance of ${method}`, () => {
|
|
19
|
+
(0, expect_1.expect)(instance).to.be.a[method]();
|
|
20
|
+
});
|
|
21
|
+
it(`should throw if value is not an instance of ${method}`, () => {
|
|
22
|
+
const regexp = new RegExp(`Expected String to be an instance of ${method}`);
|
|
23
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)(wrongInstance).to.be.a[method]()).to.throw(regexp);
|
|
24
|
+
});
|
|
25
|
+
describe('not', () => {
|
|
26
|
+
it(`should not throw if value is not an instance of ${method}`, () => {
|
|
27
|
+
(0, expect_1.expect)(wrongInstance).to.not.be.a[method]();
|
|
28
|
+
});
|
|
29
|
+
it(`should throw if value is an instance of ${method}`, () => {
|
|
30
|
+
const regexp = new RegExp(`Expected ${method} to not be an instance of ${method}`);
|
|
31
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)(instance).to.not.be.a[method]()).to.throw(regexp);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
(0, expect_1.expect)(new Date()).to.be.a.Date;
|
|
37
|
+
(0, expect_1.expect)(new Map()).to.be.a.Map;
|
|
38
|
+
(0, expect_1.expect)(new Set()).to.be.a.Set;
|
|
39
|
+
(0, expect_1.expect)(new WeakMap()).to.be.a.WeakMap;
|
|
40
|
+
(0, expect_1.expect)(new WeakSet()).to.be.a.WeakSet;
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=instance-of-shorthand.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance-of-shorthand.test.js","sourceRoot":"","sources":["../../src/expect/instance-of-shorthand.test.ts"],"names":[],"mappings":";;AAAA,6DAA6D;AAC7D,+CAA+C;AAC/C,sCAAmC;AAEnC,MAAM,SAAS,GAAG;IACd,IAAI,EAAE,IAAI,IAAI,EAAE;IAChB,GAAG,EAAE,IAAI,GAAG,EAAE;IACd,GAAG,EAAE,IAAI,GAAG,EAAE;IACd,OAAO,EAAE,IAAI,OAAO,EAAE;IACtB,OAAO,EAAE,IAAI,OAAO,EAAE;CACzB,CAAC;AAEF,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC1C,KAAK,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QACxD,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;YAClB,oDAAoD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AC,CAAC;KACN;IACD,IAAA,eAAM,EAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAChC,IAAA,eAAM,EAAC,IAAI,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9B,IAAA,eAAM,EAAC,IAAI,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9B,IAAA,eAAM,EAAC,IAAI,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IACtC,IAAA,eAAM,EAAC,IAAI,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AAC1C,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance-of.test.d.ts","sourceRoot":"","sources":["../../src/expect/instance-of.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const expect_1 = require("../expect");
|
|
4
|
+
describe('expect/instanceOf', () => {
|
|
5
|
+
it('should not throw if is correct constructor', () => {
|
|
6
|
+
(0, expect_1.expect)(new Error()).to.be.instanceOf(Error);
|
|
7
|
+
});
|
|
8
|
+
it('should throw if is not correct constructor', () => {
|
|
9
|
+
(0, expect_1.expect)(() => {
|
|
10
|
+
(0, expect_1.expect)(new Error()).to.be.instanceOf(Array);
|
|
11
|
+
}).to.throw(/Expected Error to be an instance of Array/);
|
|
12
|
+
});
|
|
13
|
+
describe('not', () => {
|
|
14
|
+
it('should throw if is correct constructor', () => {
|
|
15
|
+
(0, expect_1.expect)(() => {
|
|
16
|
+
(0, expect_1.expect)(new Error()).not.to.be.instanceOf(Error);
|
|
17
|
+
}).to.throw(/Expected Error to not be an instance of Error/);
|
|
18
|
+
});
|
|
19
|
+
it('should not throw if is not correct constructor', () => {
|
|
20
|
+
(0, expect_1.expect)(new Error()).not.to.be.instanceOf(Array);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=instance-of.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance-of.test.js","sourceRoot":"","sources":["../../src/expect/instance-of.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QAClD,IAAA,eAAM,EAAC,IAAI,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QAClD,IAAA,eAAM,EAAC,GAAG,EAAE;YACR,IAAA,eAAM,EAAC,IAAI,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACjB,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAC9C,IAAA,eAAM,EAAC,GAAG,EAAE;gBACR,IAAA,eAAM,EAAC,IAAI,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACtD,IAAA,eAAM,EAAC,IAAI,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"length.test.d.ts","sourceRoot":"","sources":["../../src/expect/length.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const expect_1 = require("../expect");
|
|
4
|
+
describe('sizeOf', () => {
|
|
5
|
+
it('should not throw if array is of correct size', () => {
|
|
6
|
+
(0, expect_1.expect)([1, 2, 3]).to.have.sizeOf(3);
|
|
7
|
+
});
|
|
8
|
+
it('should throw if array is not of correct size', () => {
|
|
9
|
+
(0, expect_1.expect)(() => {
|
|
10
|
+
(0, expect_1.expect)([1, 2, 3]).to.have.sizeOf(2);
|
|
11
|
+
}).to.throw(/Expected array to have length of 2/);
|
|
12
|
+
});
|
|
13
|
+
describe('not', () => {
|
|
14
|
+
it('should throw if array is of correct size', () => {
|
|
15
|
+
(0, expect_1.expect)(() => {
|
|
16
|
+
(0, expect_1.expect)([1, 2, 3]).not.to.have.lengthOf(3);
|
|
17
|
+
}).to.throw(/Expected array to not have length of 3/);
|
|
18
|
+
});
|
|
19
|
+
it('should not throw if array is not of correct size', () => {
|
|
20
|
+
(0, expect_1.expect)([1, 2, 3]).not.to.have.sizeOf(2);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=length.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"length.test.js","sourceRoot":"","sources":["../../src/expect/length.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EA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ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const expect_1 = require("../expect");
|
|
4
|
+
describe('expect/less-than-equal', () => {
|
|
5
|
+
it('should not throw if actual is smaller than expected', () => {
|
|
6
|
+
(0, expect_1.expect)(1).lessThanOrEqual(2);
|
|
7
|
+
});
|
|
8
|
+
it('should not throw if actual is equal to expected', () => {
|
|
9
|
+
(0, expect_1.expect)(1).lessThanOrEqual(1);
|
|
10
|
+
});
|
|
11
|
+
it('should throw if actual is greater than expected', () => {
|
|
12
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)(2).lessThanOrEqual(1)).to.throw(/Expected 2 to be less than or equal to 1/);
|
|
13
|
+
});
|
|
14
|
+
describe('not', () => {
|
|
15
|
+
it('should not throw if actual is greater than expected', () => {
|
|
16
|
+
(0, expect_1.expect)(2).to.not.be.lte(1);
|
|
17
|
+
});
|
|
18
|
+
it('should throw if actual is equal to expected', () => {
|
|
19
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)(1).not.lessThanOrEqual(1)).to.throw(/Expected 1 to not be less than or equal to 1/);
|
|
20
|
+
});
|
|
21
|
+
it('should throw if actual is smaller than expected', () => {
|
|
22
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)(1).not.lessThanOrEqual(2)).to.throw(/Expected 1 to not be less than or equal to 2/);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=less-than-equal.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less-than-equal.test.js","sourceRoot":"","sources":["../../src/expect/less-than-equal.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC3D,IAAA,eAAM,EAAC,CAAC,CA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.d.ts","sourceRoot":"","sources":["../../src/expect/less-than.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const expect_1 = require("../expect");
|
|
4
|
+
describe('expect/lessThan', () => {
|
|
5
|
+
it('should not throw if actual is smaller than expected', () => {
|
|
6
|
+
(0, expect_1.expect)(1).lessThan(2);
|
|
7
|
+
});
|
|
8
|
+
it('should throw if actual is equal to expected', () => {
|
|
9
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)(1).lt(1)).to.throw(/Expected 1 to be less than 1/);
|
|
10
|
+
});
|
|
11
|
+
it('should not throw if actual is a date lesser than expected', () => {
|
|
12
|
+
(0, expect_1.expect)(new Date(0)).to.be.lessThan(new Date(1));
|
|
13
|
+
});
|
|
14
|
+
describe('not', () => {
|
|
15
|
+
it('should not throw if actual is greater than expected', () => {
|
|
16
|
+
(0, expect_1.expect)(2).to.not.be.below(1);
|
|
17
|
+
});
|
|
18
|
+
it('should not throw if actual is equal to expected', () => {
|
|
19
|
+
(0, expect_1.expect)(1).to.not.be.below(1);
|
|
20
|
+
});
|
|
21
|
+
it('should throw if actual is smaller than expected', () => {
|
|
22
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)(1).not.lt(2)).to.throw(/Expected 1 to not be less than 2/);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=less-than.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"less-than.test.js","sourceRoot":"","sources":["../../src/expect/less-than.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC3D,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1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names":[],"mappings":"AAGA,OAAO,QAAQ,iBAAiB,CAAC;IAC7B,UAAU,YAAY,CAAC,CAAC;QACpB;;WAEG;QACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9B;CACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const assert_1 = require("../assert");
|
|
4
|
+
const mixins_1 = require("../mixins");
|
|
5
|
+
(0, mixins_1.use)({
|
|
6
|
+
match: {
|
|
7
|
+
type: 'method',
|
|
8
|
+
value: ({ value, inverted }) => (regex) => {
|
|
9
|
+
if (inverted) {
|
|
10
|
+
(0, assert_1.notMatch)(value, regex);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
(0, assert_1.match)(value, regex);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.js","sourceRoot":"","sources":["../../src/expect/match.ts"],"names":[],"mappings":";;AAAA,sCAA4C;AAC5C,sCAAgC;AAWhC,IAAA,YAAG,EAAC;IACA,KAAK,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,KAAa,EAAE,EAAE;YAC9C,IAAI,QAAQ,EAAE;gBACV,IAAA,iBAAQ,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;aAC1B;iBAAM;gBACH,IAAA,cAAK,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;aACvB;QACL,CAAC;KACJ;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.test.d.ts","sourceRoot":"","sources":["../../src/expect/match.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const expect_1 = require("../expect");
|
|
4
|
+
describe('expect/match', () => {
|
|
5
|
+
it('should not throw if regex matches actual', () => {
|
|
6
|
+
(0, expect_1.expect)('abc').match(/abc/);
|
|
7
|
+
});
|
|
8
|
+
it('should throw if regex does not match actual', () => {
|
|
9
|
+
(0, expect_1.expect)(() => {
|
|
10
|
+
(0, expect_1.expect)('abc').match(/def/);
|
|
11
|
+
}).to.throw(/Expected abc to match \/def\//);
|
|
12
|
+
});
|
|
13
|
+
describe('not', () => {
|
|
14
|
+
it('should not throw if regex does not match actual', () => {
|
|
15
|
+
(0, expect_1.expect)('abc').not.match(/def/);
|
|
16
|
+
});
|
|
17
|
+
it('should throw if regex matches actual', () => {
|
|
18
|
+
(0, expect_1.expect)(() => {
|
|
19
|
+
(0, expect_1.expect)('abc').not.match(/abc/);
|
|
20
|
+
}).to.throw(/Expected abc to not match \/abc\//);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=match.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.test.js","sourceRoot":"","sources":["../../src/expect/match.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAChD,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACnD,IAAA,eAAM,EAAC,GAAG,EAAE;YACR,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACjB,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;YACvD,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC5C,IAAA,eAAM,EAAC,GAAG,EAAE;gBACR,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reject.test.d.ts","sourceRoot":"","sources":["../../src/expect/reject.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const assert_1 = require("../assert");
|
|
4
|
+
const expect_1 = require("../expect");
|
|
5
|
+
describe('expect/rejects', () => {
|
|
6
|
+
it('should not reject if promise rejects', async () => {
|
|
7
|
+
const regexp = /Hello darkness my old friend/;
|
|
8
|
+
await (0, expect_1.expect)(Promise.reject(new Error('Hello darkness my old friend'))).to.reject(regexp);
|
|
9
|
+
});
|
|
10
|
+
it(`should reject if error doesn't match the provided regex`, async () => {
|
|
11
|
+
const regexp = /Hello darkness my old friend/;
|
|
12
|
+
await (0, assert_1.rejects)((0, expect_1.expect)(Promise.reject(new Error(`I've come to talk to you again`))).to.reject(regexp));
|
|
13
|
+
});
|
|
14
|
+
it('should reject if promise resolves', async () => {
|
|
15
|
+
await (0, assert_1.rejects)((0, expect_1.expect)(Promise.resolve()).to.reject(), /Expected Promise to reject/);
|
|
16
|
+
});
|
|
17
|
+
describe('not', () => {
|
|
18
|
+
it('should not reject if promise resolves', async () => {
|
|
19
|
+
await (0, expect_1.expect)(Promise.resolve()).to.not.reject();
|
|
20
|
+
});
|
|
21
|
+
it('should reject if promise rejects', async () => {
|
|
22
|
+
await (0, assert_1.rejects)((0, expect_1.expect)(Promise.reject(new Error('Hello darkness my old friend'))).to.not.reject());
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=reject.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reject.test.js","sourceRoot":"","sources":["../../src/expect/reject.test.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AACpC,sCAAmC;AAEnC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,MAAM,GAAG,8BAA8B,CAAC;QAC9C,MAAM,IAAA,eAAM,EAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9F,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;QACrE,MAAM,MAAM,GAAG,8BAA8B,CAAC;QAC9C,MAAM,IAAA,gBAAO,EAAC,IAAA,eAAM,EAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACzG,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;QAC/C,MAAM,IAAA,gBAAO,EAAC,IAAA,eAAM,EAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,4BAA4B,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACjB,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;YACnD,MAAM,IAAA,eAAM,EAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACpD,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;YAC9C,MAAM,IAAA,gBAAO,EAAC,IAAA,eAAM,EAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QACrG,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throw.test.d.ts","sourceRoot":"","sources":["../../src/expect/throw.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const assert_1 = require("../assert");
|
|
4
|
+
const expect_1 = require("../expect");
|
|
5
|
+
describe('expect/throw', () => {
|
|
6
|
+
it(`should throw if the callback doesn't throw`, () => {
|
|
7
|
+
(0, assert_1.throws)(() => (0, expect_1.expect)(() => { }).to.throw());
|
|
8
|
+
});
|
|
9
|
+
it('should not throw if callback throws', () => {
|
|
10
|
+
(0, expect_1.expect)(() => {
|
|
11
|
+
throw new Error('Things are bad');
|
|
12
|
+
}).to.throw();
|
|
13
|
+
});
|
|
14
|
+
it('should accept arguments', () => {
|
|
15
|
+
class CustomError extends Error {
|
|
16
|
+
}
|
|
17
|
+
const callback = () => { throw new Error(); };
|
|
18
|
+
(0, assert_1.throws)(() => (0, expect_1.expect)(callback).to.throw(CustomError), /Expected function to throw CustomError/);
|
|
19
|
+
});
|
|
20
|
+
describe('not', () => {
|
|
21
|
+
it(`should not throw if callback doesn't throw and it's inverted`, () => {
|
|
22
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)(() => { }).not.to.throw()).not.to.throw();
|
|
23
|
+
});
|
|
24
|
+
it(`should throw if callback throws and it's inverted`, () => {
|
|
25
|
+
(0, assert_1.throws)(() => (0, expect_1.expect)(() => {
|
|
26
|
+
throw new Error('Things are bad');
|
|
27
|
+
}).not.to.throw());
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=throw.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throw.test.js","sourceRoot":"","sources":["../../src/expect/throw.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AACnC,sCAAmC;AAEnC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QAClD,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,IAAA,eAAM,EAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC3C,IAAA,eAAM,EAAC,GAAG,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QAC/B,MAAM,WAAY,SAAQ,KAAK;SAAI;QACnC,MAAM,QAAQ,GAAG,GAAG,EAAE,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9C,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,wCAAwC,CAAC,CAAC;IACnG,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACjB,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;YACpE,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,IAAA,eAAM,EAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAClE,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YACzD,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,IAAA,eAAM,EAAC,GAAG,EAAE;gBACrB,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-shorthand.d.ts","sourceRoot":"","sources":["../../src/expect/type-shorthand.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,iBAAiB,CAAC;IAC7B,UAAU,YAAY,CAAC,CAAC;QACpB;;WAEG;QACH,MAAM,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"type-shorthand.d.ts","sourceRoot":"","sources":["../../src/expect/type-shorthand.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,iBAAiB,CAAC;IAC7B,UAAU,YAAY,CAAC,CAAC;QACpB;;WAEG;QACH,MAAM,IAAI,IAAI,CAAC;QACf;;WAEG;QACH,GAAG,IAAI,IAAI,CAAC;KACf;IACD,UAAU,WAAW,CAAC,CAAC;QACnB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACjB;IACD,UAAU,YAAY,CAAC,CAAC;QACpB;;WAEG;QACH,MAAM,IAAI,IAAI,CAAC;KAClB;IACD,UAAU,aAAa;QACnB;;WAEG;QACH,OAAO,IAAI,IAAI,CAAC;KACnB;IACD,UAAU,cAAc,CAAC,CAAC;QACtB;;WAEG;QACH,QAAQ,IAAI,IAAI,CAAC;KACpB;IACD,UAAU,WAAW,CAAC,CAAC;QACnB;;WAEG;QACH,IAAI,IAAI,IAAI,CAAC;QACb;;WAEG;QACH,SAAS,IAAI,IAAI,CAAC;KACrB;IACD,UAAU,YAAY,CAAC,CAAC;QACpB;;WAEG;QACH,MAAM,IAAI,IAAI,CAAC;KAClB;IACD,UAAU,YAAY,CAAC,CAAC;QACpB;;WAEG;QACH,MAAM,IAAI,IAAI,CAAC;KAClB;IACD,UAAU,YAAY,CAAC,CAAC;QACpB;;WAEG;QACH,MAAM,IAAI,IAAI,CAAC;KAClB;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-shorthand.test.d.ts","sourceRoot":"","sources":["../../src/expect/type-shorthand.test.ts"],"names":[],"mappings":""}
|