hein 0.0.2 → 0.0.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/CHANGELOG.md +7 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/assert/eql.js +2 -2
- package/dist/assert/eql.js.map +1 -1
- package/dist/assert/eql.test.d.ts +2 -0
- package/dist/assert/eql.test.d.ts.map +1 -0
- package/dist/assert/eql.test.js +111 -0
- package/dist/assert/eql.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-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/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/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/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.test.d.ts +2 -0
- package/dist/expect/eql.test.d.ts.map +1 -0
- package/dist/expect/eql.test.js +25 -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.test.d.ts +2 -0
- package/dist/expect/equal.test.d.ts.map +1 -0
- package/dist/expect/equal.test.js +27 -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/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/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.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 +1 -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 +1 -1
- package/dist/mixins.d.ts.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 +23 -12
- package/.eslintrc +0 -167
- package/.mocharc.json +0 -4
- package/.nycrc +0 -16
- package/DIFFERENCES_WITH_CHAI.md +0 -49
- 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,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const assert_1 = require("../assert");
|
|
4
|
+
class FailError extends Error {
|
|
5
|
+
}
|
|
6
|
+
const fail = () => {
|
|
7
|
+
throw new FailError('Expected promise to reject');
|
|
8
|
+
};
|
|
9
|
+
describe('assert/rejects', () => {
|
|
10
|
+
class CustomError extends Error {
|
|
11
|
+
}
|
|
12
|
+
const reject = async (message = 'Things are bad') => {
|
|
13
|
+
throw new Error(message);
|
|
14
|
+
};
|
|
15
|
+
const rejectCustomError = async () => {
|
|
16
|
+
throw new CustomError('Things are bad');
|
|
17
|
+
};
|
|
18
|
+
it(`should reject if the callback doesn't reject`, async () => {
|
|
19
|
+
try {
|
|
20
|
+
await (0, assert_1.rejects)(Promise.resolve());
|
|
21
|
+
fail();
|
|
22
|
+
}
|
|
23
|
+
catch (_a) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
it('should not throw if callback rejects', async () => {
|
|
28
|
+
await (0, assert_1.rejects)(Promise.reject(new Error()));
|
|
29
|
+
});
|
|
30
|
+
it('should throw with provided message', async () => {
|
|
31
|
+
try {
|
|
32
|
+
await (0, assert_1.rejects)(Promise.resolve(), 'Things are not good');
|
|
33
|
+
fail();
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (error instanceof FailError) {
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
if (error.message !== 'Things are not good') {
|
|
40
|
+
throw new Error('Expected message to be "Things are not good"');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
it(`should not throw if error message matches the provided RegExp`, async () => {
|
|
45
|
+
await (0, assert_1.rejects)(rejectCustomError(), /Things are bad/);
|
|
46
|
+
});
|
|
47
|
+
it(`should throw if error message doesn't match the provided RegExp`, async () => {
|
|
48
|
+
await (0, assert_1.rejects)((0, assert_1.rejects)(rejectCustomError(), /Things are good/), /Expected Promise to reject with an error matching \/Things are good\//);
|
|
49
|
+
});
|
|
50
|
+
it(`should throw with the provide message if error message doesn't match the provided RegExp`, async () => {
|
|
51
|
+
await (0, assert_1.rejects)((0, assert_1.rejects)(rejectCustomError(), /Things are good/, 'Damn'), /Damn/);
|
|
52
|
+
});
|
|
53
|
+
it(`should throw if error isn't an instance of the provided constructor`, async () => {
|
|
54
|
+
await (0, assert_1.rejects)((0, assert_1.rejects)(Promise.reject(new Error()), CustomError), /Expected Promise to reject with CustomError/);
|
|
55
|
+
});
|
|
56
|
+
it('should not throw if error is an instance of the provided constructor', async () => {
|
|
57
|
+
await (0, assert_1.rejects)(rejectCustomError(), CustomError);
|
|
58
|
+
});
|
|
59
|
+
it(`should throw with the provided message if error isn't an instance of the provided constructor`, async () => {
|
|
60
|
+
await (0, assert_1.rejects)((0, assert_1.rejects)(Promise.reject(new Error()), CustomError), /Expected Promise to reject with CustomError/);
|
|
61
|
+
});
|
|
62
|
+
it('should throw if error predicate function returns false for the thrown error', async () => {
|
|
63
|
+
await (0, assert_1.rejects)((0, assert_1.rejects)(Promise.reject(new Error('oops')), () => false), /Expected Error: oops to match predicate function/);
|
|
64
|
+
});
|
|
65
|
+
it('should not throw if error predicate function returns true for the thrown error', async () => {
|
|
66
|
+
await (0, assert_1.rejects)(Promise.reject(new Error()), () => true);
|
|
67
|
+
});
|
|
68
|
+
it('should throw with the provided message if error predicate function returns false for the thrown error', async () => {
|
|
69
|
+
await (0, assert_1.rejects)((0, assert_1.rejects)(Promise.reject(new Error()), () => false, 'Damn'), /Damn/);
|
|
70
|
+
});
|
|
71
|
+
describe('assert/notRejects', () => {
|
|
72
|
+
it(`should not reject if promise resolves`, async () => {
|
|
73
|
+
await (0, assert_1.notRejects)(Promise.resolve());
|
|
74
|
+
});
|
|
75
|
+
it('should reject if promise rejects', async () => {
|
|
76
|
+
await (0, assert_1.rejects)((0, assert_1.notRejects)(reject()), /Expected Promise to not reject/);
|
|
77
|
+
});
|
|
78
|
+
it('should reject with specified message', async () => {
|
|
79
|
+
await (0, assert_1.rejects)((0, assert_1.notRejects)(reject(), 'Error happened'), /Error happened/);
|
|
80
|
+
});
|
|
81
|
+
it('should throw when error matches the provided RegExp', async () => {
|
|
82
|
+
await (0, assert_1.rejects)((0, assert_1.notRejects)(reject('Correct'), /Correct/), /Expected Promise to not reject with an error matching \/Correct\//);
|
|
83
|
+
});
|
|
84
|
+
it(`should not throw when error doesn't match the provided RegExp`, async () => {
|
|
85
|
+
await (0, assert_1.notRejects)(reject('Correct'), /Incorrect/);
|
|
86
|
+
});
|
|
87
|
+
it('should throw when error matches the provided constructor', async () => {
|
|
88
|
+
await (0, assert_1.rejects)((0, assert_1.notRejects)(rejectCustomError(), CustomError), /Expected Promise to not reject with a CustomError/);
|
|
89
|
+
});
|
|
90
|
+
it(`should not throw when error doesn't match the provided constructor`, async () => {
|
|
91
|
+
await (0, assert_1.notRejects)((0, assert_1.notRejects)(reject(), CustomError));
|
|
92
|
+
});
|
|
93
|
+
it('should throw when error matches the provided predicate', async () => {
|
|
94
|
+
await (0, assert_1.rejects)((0, assert_1.notRejects)(reject(), () => true), /Expected Error: Things are bad to not match predicate function/);
|
|
95
|
+
});
|
|
96
|
+
it(`should not throw when error doesn't match the provided predicate`, async () => {
|
|
97
|
+
await (0, assert_1.notRejects)(reject(), () => false);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=rejects.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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qD,EAAE,KAAK,IAAI,EAAE;YACjE,MAAM,IAAA,gBAAO,EAAC,IAAA,mBAAU,EAAC,MAAM,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,EAAE,mEAAmE,CAAC,CAAC;QACjI,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,+DAA+D,EAAE,KAAK,IAAI,EAAE;YAC3E,MAAM,IAAA,mBAAU,EAAC,MAAM,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;YACtE,MAAM,IAAA,gBAAO,EAAC,IAAA,mBAAU,EAAC,iBAAiB,EAAE,EAAE,WAAW,CAAC,EAAE,mDAAmD,CAAC,CAAC;QACrH,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,oEAAoE,EAAE,KAAK,IAAI,EAAE;YAChF,MAAM,IAAA,mBAAU,EAAC,IAAA,mBAAU,EAAC,MAAM,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;YACpE,MAAM,IAAA,gBAAO,EAAC,IAAA,mBAAU,EAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,gEAAgE,CAAC,CAAC;QACtH,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,kEAAkE,EAAE,KAAK,IAAI,EAAE;YAC9E,MAAM,IAAA,mBAAU,EAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/dist/assert/throws.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.notThrows = exports.throws = void 0;
|
|
5
|
-
const
|
|
5
|
+
const hein_assertion_utils_1 = require("hein-assertion-utils");
|
|
6
6
|
const get_type_1 = require("../utils/get-type");
|
|
7
7
|
const process_error_1 = require("../utils/process-error");
|
|
8
8
|
const messages = {
|
|
@@ -16,12 +16,12 @@ const messages = {
|
|
|
16
16
|
notPredicate: 'Expected function to not throw an error matching the predicate',
|
|
17
17
|
notRegex: 'Expected function to not throw an error matching {{expected}}'
|
|
18
18
|
};
|
|
19
|
-
_a = (0,
|
|
19
|
+
_a = (0, hein_assertion_utils_1.createAssertion)({
|
|
20
20
|
messages: messages,
|
|
21
21
|
test: (report) => ((callback, narrowerOrMessage, message) => {
|
|
22
22
|
const argumentType = (0, get_type_1.getType)(callback);
|
|
23
23
|
if (argumentType !== 'function') {
|
|
24
|
-
throw new
|
|
24
|
+
throw new hein_assertion_utils_1.AssertionError(argumentType, 'function', `Expected ${argumentType} to be a function`);
|
|
25
25
|
}
|
|
26
26
|
try {
|
|
27
27
|
callback();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throws.js","sourceRoot":"","sources":["../../src/assert/throws.ts"],"names":[],"mappings":";;;;AAAA
|
|
1
|
+
{"version":3,"file":"throws.js","sourceRoot":"","sources":["../../src/assert/throws.ts"],"names":[],"mappings":";;;;AAAA,+DAAuE;AACvE,gDAA4C;AAC5C,0DAAmF;AAUnF,MAAM,QAAQ,GAAG;IACb,QAAQ,EAAE,iDAAiD;IAC3D,MAAM,EAAE,4BAA4B;IACpC,kBAAkB,EAAE,yCAAyC;IAC7D,SAAS,EAAE,iDAAiD;IAC5D,KAAK,EAAE,2DAA2D;IAClE,GAAG,EAAE,gCAAgC;IACrC,cAAc,EAAE,+CAA+C;IAC/D,YAAY,EAAE,gEAAgE;IAC9E,QAAQ,EAAE,+DAA+D;CAC5E,CAAC;AAEW,KAAsB,IAAA,sCAAe,EAAC;IAC/C,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,EAAE;QACxD,MAAM,YAAY,GAAG,IAAA,kBAAO,EAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,YAAY,KAAK,UAAU,EAAE;YAC7B,MAAM,IAAI,qCAAc,CAAC,YAAY,EAAE,UAAU,EAAE,YAAa,YAAa,mBAAmB,CAAC,CAAC;SACrG;QACD,IAAI;YACA,QAAQ,EAAE,CAAC;SACd;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,IAAA,4BAAY,EAAC,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;SAClE;QACD,OAAO,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7J,CAAC,CAAU;CACd,CAAC,EAdY,cAAM,UAAE,iBAAS,SAc5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throws.test.d.ts","sourceRoot":"","sources":["../../src/assert/throws.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const assert_1 = require("../assert");
|
|
4
|
+
class FailError extends Error {
|
|
5
|
+
}
|
|
6
|
+
const fail = () => {
|
|
7
|
+
throw new FailError('Expected function to throw');
|
|
8
|
+
};
|
|
9
|
+
describe('assert/throws', () => {
|
|
10
|
+
it(`should throw if the callback doesn't throw`, () => {
|
|
11
|
+
try {
|
|
12
|
+
(0, assert_1.throws)(() => { });
|
|
13
|
+
fail();
|
|
14
|
+
}
|
|
15
|
+
catch (_a) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
it('should not throw if callback throws', () => {
|
|
20
|
+
(0, assert_1.throws)(() => {
|
|
21
|
+
throw new Error('Things are bad');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
it('should throw with provided message', () => {
|
|
25
|
+
try {
|
|
26
|
+
(0, assert_1.throws)(() => { }, 'Things are bad');
|
|
27
|
+
fail();
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (error instanceof FailError) {
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
if (error.message !== 'Things are bad') {
|
|
34
|
+
throw new Error('Expected message to be "Things are bad"');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
it(`should not throw if error message matches the provided RegExp`, () => {
|
|
39
|
+
(0, assert_1.throws)(() => {
|
|
40
|
+
throw new Error('Things are bad');
|
|
41
|
+
}, /Things are bad/);
|
|
42
|
+
});
|
|
43
|
+
it(`should throw if error message doesn't match the provided RegExp`, () => {
|
|
44
|
+
(0, assert_1.throws)(() => {
|
|
45
|
+
(0, assert_1.throws)(() => {
|
|
46
|
+
throw new Error('Things are bad');
|
|
47
|
+
}, /Things are good/);
|
|
48
|
+
}, /Expected function to throw an error matching \/Things are good\//);
|
|
49
|
+
});
|
|
50
|
+
it(`should throw with the provide message if error message doesn't match the provided RegExp`, () => {
|
|
51
|
+
(0, assert_1.throws)(() => {
|
|
52
|
+
(0, assert_1.throws)(() => {
|
|
53
|
+
throw new Error('Things are bad');
|
|
54
|
+
}, /Things are good/, 'Damn');
|
|
55
|
+
}, /Damn/);
|
|
56
|
+
});
|
|
57
|
+
it(`should throw if error isn't an instance of the provided constructor`, () => {
|
|
58
|
+
class CustomError extends Error {
|
|
59
|
+
}
|
|
60
|
+
(0, assert_1.throws)(() => {
|
|
61
|
+
(0, assert_1.throws)(() => { throw new Error(); }, CustomError);
|
|
62
|
+
}, /Expected function to throw CustomError/);
|
|
63
|
+
});
|
|
64
|
+
it('should not throw if error is an instance of the provided constructor', () => {
|
|
65
|
+
class CustomError extends Error {
|
|
66
|
+
}
|
|
67
|
+
(0, assert_1.throws)(() => { throw new CustomError(); }, CustomError);
|
|
68
|
+
});
|
|
69
|
+
it(`should throw with the provided message if error isn't an instance of the provided constructor`, () => {
|
|
70
|
+
class CustomError extends Error {
|
|
71
|
+
}
|
|
72
|
+
(0, assert_1.throws)(() => {
|
|
73
|
+
(0, assert_1.throws)(() => { throw new Error(); }, CustomError, 'Damn');
|
|
74
|
+
}, /Damn/);
|
|
75
|
+
});
|
|
76
|
+
it('should throw if error predicate function returns false for the thrown error', () => {
|
|
77
|
+
(0, assert_1.throws)(() => {
|
|
78
|
+
(0, assert_1.throws)(() => { throw new Error('oops'); }, () => false);
|
|
79
|
+
}, /Expected Error: oops to match predicate function/);
|
|
80
|
+
});
|
|
81
|
+
it('should not throw if error predicate function returns true for the thrown error', () => {
|
|
82
|
+
(0, assert_1.throws)(() => { throw new Error('oops'); }, () => true);
|
|
83
|
+
});
|
|
84
|
+
it('should throw with the provided message if error predicate function returns false for the thrown error', () => {
|
|
85
|
+
(0, assert_1.throws)(() => {
|
|
86
|
+
(0, assert_1.throws)(() => { throw new Error('oops'); }, () => false, 'Damn');
|
|
87
|
+
}, /Damn/);
|
|
88
|
+
});
|
|
89
|
+
it('should throw if first argument is not a function', () => {
|
|
90
|
+
try {
|
|
91
|
+
(0, assert_1.throws)(1);
|
|
92
|
+
fail();
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
if (error instanceof FailError) {
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
if (error.message !== 'Expected number to be a function') {
|
|
99
|
+
throw new Error(`Expected "${error.message}" to be "Expected number to be a function"`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
describe('assert/notThrows', () => {
|
|
104
|
+
const errorCallback = () => {
|
|
105
|
+
throw new Error('Correct');
|
|
106
|
+
};
|
|
107
|
+
it(`should not throw error if callback doesn't throw`, () => {
|
|
108
|
+
(0, assert_1.notThrows)(() => { });
|
|
109
|
+
});
|
|
110
|
+
it('should throw error if callback throws', () => {
|
|
111
|
+
(0, assert_1.throws)(() => (0, assert_1.notThrows)(errorCallback));
|
|
112
|
+
});
|
|
113
|
+
it('should throw errors with specified message', () => {
|
|
114
|
+
(0, assert_1.throws)(() => (0, assert_1.notThrows)(errorCallback, 'Error happened'), /Error happened/);
|
|
115
|
+
});
|
|
116
|
+
it('should throw when error matches the provided RegExp', () => {
|
|
117
|
+
(0, assert_1.throws)(() => (0, assert_1.notThrows)(errorCallback, /Correct/), /Expected function to not throw/);
|
|
118
|
+
});
|
|
119
|
+
it(`should not throw when error doesn't match the provided RegExp`, () => {
|
|
120
|
+
(0, assert_1.notThrows)(errorCallback, /Incorrect/);
|
|
121
|
+
});
|
|
122
|
+
it('should throw when error matches the provided constructor', () => {
|
|
123
|
+
class CustomError extends Error {
|
|
124
|
+
}
|
|
125
|
+
(0, assert_1.throws)(() => (0, assert_1.notThrows)(() => { throw new CustomError(); }, CustomError), /Expected function to not throw a CustomError/);
|
|
126
|
+
});
|
|
127
|
+
it(`should not throw when error doesn't match the provided constructor`, () => {
|
|
128
|
+
class CustomError extends Error {
|
|
129
|
+
}
|
|
130
|
+
(0, assert_1.notThrows)(() => (0, assert_1.notThrows)(() => { throw new Error(); }, CustomError));
|
|
131
|
+
});
|
|
132
|
+
it('should throw when error matches the provided predicate', () => {
|
|
133
|
+
(0, assert_1.throws)(() => (0, assert_1.notThrows)(() => { throw new Error(); }, () => true), /Expected function to not throw/);
|
|
134
|
+
});
|
|
135
|
+
it(`should not throw when error doesn't match the provided predicate`, () => {
|
|
136
|
+
(0, assert_1.notThrows)(() => { throw new Error(); }, () => false);
|
|
137
|
+
});
|
|
138
|
+
it('should throw if first argument is not a function', () => {
|
|
139
|
+
try {
|
|
140
|
+
(0, assert_1.notThrows)(1);
|
|
141
|
+
fail();
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
if (error instanceof FailError) {
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
if (error.message !== 'Expected number to be a function') {
|
|
148
|
+
throw new Error(`Expected "${error.message}" to be "Expected number to be a function"`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
//# sourceMappingURL=throws.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throws.test.js","sourceRoot":"","sources":["../../src/assert/throws.test.ts"],"names":[],"mappings":";;AAAA,sCAA8C;AAE9C,MAAM,SAAU,SAAQ,KAAK;CAAI;AAEjC,MAAM,IAAI,GAAG,GAAG,EAAE;IACd,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QAClD,IAAI;YACA,IAAA,eAAM,EAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAClB,IAAI,EAAE,CAAC;SACV;QAAC,WAAM;YACJ,OAAO;SACV;IACL,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;IACP,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC1C,IAAI;YACA,IAAA,eAAM,EAAC,GAAG,EAAE,GAAG,CAAC,EAAE,gBAAgB,CAAC,CAAC;YACpC,IAAI,EAAE,CAAC;SACV;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,KAAK,YAAY,SAAS,EAAE;gBAC5B,MAAM,KAAK,CAAC;aACf;YACD,IAAI,KAAK,CAAC,OAAO,KAAK,gBAAgB,EAAE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AAO,KAAK,kCAAkC,EAAE;oBACtD,MAAM,IAAI,KAAK,CAAC,aAAc,KAAK,CAAC,OAAQ,4CAA4C,CAAC,CAAC;iBAC7F;aACJ;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty.test.d.ts","sourceRoot":"","sources":["../../src/expect/empty.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/empty', () => {
|
|
5
|
+
it('should not throw if array is empty', () => {
|
|
6
|
+
(0, expect_1.expect)([]).to.be.empty();
|
|
7
|
+
});
|
|
8
|
+
it('should throw if array is not empty', () => {
|
|
9
|
+
(0, expect_1.expect)(() => {
|
|
10
|
+
(0, expect_1.expect)([1]).to.be.empty();
|
|
11
|
+
}).to.throw(/Expected array to be empty/);
|
|
12
|
+
});
|
|
13
|
+
describe('not', () => {
|
|
14
|
+
it('should throw if array is empty', () => {
|
|
15
|
+
(0, expect_1.expect)(() => {
|
|
16
|
+
(0, expect_1.expect)([]).not.to.be.empty();
|
|
17
|
+
}).to.throw(/Expected array to not be empty/);
|
|
18
|
+
});
|
|
19
|
+
it('should not throw if array is not empty', () => {
|
|
20
|
+
(0, expect_1.expect)([1]).not.to.be.empty();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=empty.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty.test.js","sourceRoot":"","sources":["../../src/expect/empty.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC1C,IAAA,eAAM,EAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC1C,IAAA,eAAM,EAAC,GAAG,EAAE;YACR,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACjB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;YACtC,IAAA,eAAM,EAAC,GAAG,EAAE;gBACR,IAAA,eAAM,EAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;YACjC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAC9C,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAClC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eql.test.d.ts","sourceRoot":"","sources":["../../src/expect/eql.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const expect_1 = require("../expect");
|
|
4
|
+
describe('expect/eql', () => {
|
|
5
|
+
it('should not throw for deep equality', () => {
|
|
6
|
+
(0, expect_1.expect)({ a: 1 }).to.eql({ a: 1 });
|
|
7
|
+
});
|
|
8
|
+
it('should not throw with functions', () => {
|
|
9
|
+
const x = () => { };
|
|
10
|
+
(0, expect_1.expect)(x).to.eql(x);
|
|
11
|
+
});
|
|
12
|
+
it('should throw when one object has a different value for the same property', () => {
|
|
13
|
+
(0, expect_1.expect)(() => {
|
|
14
|
+
(0, expect_1.expect)({ a: 1 }).to.eql({ a: 2 });
|
|
15
|
+
}).to.throw(); // TODO:expect a certain message
|
|
16
|
+
});
|
|
17
|
+
describe('not', () => {
|
|
18
|
+
it('should invert the assertion', () => {
|
|
19
|
+
(0, expect_1.expect)(() => {
|
|
20
|
+
(0, expect_1.expect)({ a: 1 }).not.to.eql({ a: 1 });
|
|
21
|
+
}).to.throw();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=eql.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eql.test.js","sourceRoot":"","sources":["../../src/expect/eql.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC1C,IAAA,eAAM,EAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;QACpB,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,0EAA0E,EAAE,GAAG,EAAE;QAChF,IAAA,eAAM,EAAC,GAAG,EAAE;YACR,IAAA,eAAM,EAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,gCAAgC;IACnD,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACjB,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACnC,IAAA,eAAM,EAAC,GAAG,EAAE;gBACR,IAAA,eAAM,EAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const assert_1 = require("../assert");
|
|
4
4
|
const mixins_1 = require("../mixins");
|
|
5
|
-
const
|
|
5
|
+
const hein_assertion_utils_1 = require("hein-assertion-utils");
|
|
6
6
|
const values = {
|
|
7
7
|
false: false,
|
|
8
8
|
true: true
|
|
@@ -12,14 +12,14 @@ const values = {
|
|
|
12
12
|
type: 'method',
|
|
13
13
|
value: ({ inverted, value }) => () => {
|
|
14
14
|
if (inverted) {
|
|
15
|
-
const message = (0,
|
|
15
|
+
const message = (0, hein_assertion_utils_1.format)('Expected {{ value }} to not be {{ key }}', {
|
|
16
16
|
key,
|
|
17
17
|
value
|
|
18
18
|
}, true);
|
|
19
19
|
(0, assert_1.notEqual)(value, expectValue, message);
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
|
-
const message = (0,
|
|
22
|
+
const message = (0, hein_assertion_utils_1.format)('Expected {{ value }} to be {{ key }}', {
|
|
23
23
|
key,
|
|
24
24
|
value
|
|
25
25
|
}, true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equal-shorthand.js","sourceRoot":"","sources":["../../src/expect/equal-shorthand.ts"],"names":[],"mappings":";;AAAA,sCAA4C;AAC5C,sCAAuC;AACvC
|
|
1
|
+
{"version":3,"file":"equal-shorthand.js","sourceRoot":"","sources":["../../src/expect/equal-shorthand.ts"],"names":[],"mappings":";;AAAA,sCAA4C;AAC5C,sCAAuC;AACvC,+DAA8C;AAgB9C,MAAM,MAAM,GAAG;IACX,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,IAAI;CACb,CAAC;AAEF,IAAA,YAAG,EAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE;IACrE,OAAO,CAAC,GAAG,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAc,EAAE,EAAE,CAAC,GAAG,EAAE;gBAC7C,IAAI,QAAQ,EAAE;oBACV,MAAM,OAAO,GAAG,IAAA,6BAAM,EAClB,0CAA0C,EAC1C;wBACI,GAAG;wBACH,KAAK;qBACR,EACD,IAAI,CACP,CAAC;oBACF,IAAA,iBAAQ,EAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;iBACzC;qBAAM;oBACH,MAAM,OAAO,GAAG,IAAA,6BAAM,EAClB,sCAAsC,EACtC;wBACI,GAAG;wBACH,KAAK;qBACR,EACD,IAAI,CACP,CAAC;oBACF,IAAA,cAAK,EAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;iBACtC;YACL,CAAC;SACJ,CAAC,CAAC;AACP,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equal-shorthand.test.d.ts","sourceRoot":"","sources":["../../src/expect/equal-shorthand.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable mocha/no-setup-in-describe */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
5
|
+
const expect_1 = require("../expect");
|
|
6
|
+
const values = {
|
|
7
|
+
false: false,
|
|
8
|
+
true: true
|
|
9
|
+
};
|
|
10
|
+
describe('expect/equal shorthands', () => {
|
|
11
|
+
for (const [method, value] of Object.entries(values)) {
|
|
12
|
+
describe(method, () => {
|
|
13
|
+
it(`should not throw if value is ${method}`, () => {
|
|
14
|
+
(0, expect_1.expect)(value).to.be[method]();
|
|
15
|
+
});
|
|
16
|
+
it(`should throw if value is not ${method}`, () => {
|
|
17
|
+
const regex = new RegExp(`Expected ${!value} to be ${method}`);
|
|
18
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)(!value).to.be[method]()).to.throw(regex);
|
|
19
|
+
});
|
|
20
|
+
describe('not', () => {
|
|
21
|
+
it(`should not throw if value is ${!value}`, () => {
|
|
22
|
+
(0, expect_1.expect)(!value).to.not.be[method]();
|
|
23
|
+
});
|
|
24
|
+
it(`should throw if value is ${value}`, () => {
|
|
25
|
+
const regex = new RegExp(`Expected ${value} to not be ${method}`);
|
|
26
|
+
(0, expect_1.expect)(() => (0, expect_1.expect)(value).to.not.be[method]()).to.throw(regex);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
(0, expect_1.expect)(false).to.be.false;
|
|
32
|
+
(0, expect_1.expect)(true).to.be.true;
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=equal-shorthand.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equal-shorthand.test.js","sourceRoot":"","sources":["../../src/expect/equal-shorthand.test.ts"],"names":[],"mappings":";;AAAA,+CAA+C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C,GAAG,EAAE,CAAC,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACpE,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;KACN;IACD,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IAC1B,IAAA,eAAM,EAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equal.test.d.ts","sourceRoot":"","sources":["../../src/expect/equal.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const expect_1 = require("../expect");
|
|
4
|
+
describe('expect/equal', () => {
|
|
5
|
+
it('should not throw for strict equality', () => {
|
|
6
|
+
(0, expect_1.expect)(1).to.eq(1);
|
|
7
|
+
});
|
|
8
|
+
it('should throw if values are not equal', () => {
|
|
9
|
+
(0, expect_1.expect)(() => {
|
|
10
|
+
// @ts-expect-error intentionally wrong type
|
|
11
|
+
(0, expect_1.expect)(1).to.equal('a');
|
|
12
|
+
}).to.throw();
|
|
13
|
+
});
|
|
14
|
+
it('should throw if values are only deep equal', () => {
|
|
15
|
+
(0, expect_1.expect)(() => {
|
|
16
|
+
(0, expect_1.expect)({ a: 1 }).to.equal({ a: 1 });
|
|
17
|
+
}).to.throw();
|
|
18
|
+
});
|
|
19
|
+
describe('not', () => {
|
|
20
|
+
it('should invert the assertion', () => {
|
|
21
|
+
(0, expect_1.expect)(() => {
|
|
22
|
+
(0, expect_1.expect)(1).not.to.equal(1);
|
|
23
|
+
}).to.throw();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=equal.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equal.test.js","sourceRoot":"","sources":["../../src/expect/equal.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC5C,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC5C,IAAA,eAAM,EAAC,GAAG,EAAE;YACR,4CAA4C;YAC5C,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QAClD,IAAA,eAAM,EAAC,GAAG,EAAE;YACR,IAAA,eAAM,EAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACjB,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACnC,IAAA,eAAM,EAAC,GAAG,EAAE;gBACR,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greater-than-equal.test.d.ts","sourceRoot":"","sources":["../../src/expect/greater-than-equal.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/greaterThanEqual', () => {
|
|
5
|
+
it('should not throw when expectation is smaller than actual', () => {
|
|
6
|
+
(0, expect_1.expect)(1).to.be.greaterThanOrEqual(0);
|
|
7
|
+
});
|
|
8
|
+
it('should not throw when expectation is equal to actual', () => {
|
|
9
|
+
(0, expect_1.expect)(1).to.be.greaterThanOrEqual(1);
|
|
10
|
+
});
|
|
11
|
+
it('should throw when expectation is bigger than actual', () => {
|
|
12
|
+
(0, expect_1.expect)(() => {
|
|
13
|
+
(0, expect_1.expect)(1).to.be.greaterThanOrEqual(2);
|
|
14
|
+
}).to.throw();
|
|
15
|
+
});
|
|
16
|
+
describe('not', () => {
|
|
17
|
+
it('should invert the assertion', () => {
|
|
18
|
+
(0, expect_1.expect)(() => {
|
|
19
|
+
(0, expect_1.expect)(1).not.to.be.greaterThanOrEqual(0);
|
|
20
|
+
}).to.throw();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=greater-than-equal.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greater-than-equal.test.js","sourceRoot":"","sources":["../../src/expect/greater-than-equal.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAChE,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC5D,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC3D,IAAA,eAAM,EAAC,GAAG,EAAE;YACR,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACjB,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACnC,IAAA,eAAM,EAAC,GAAG,EAAE;gBACR,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greater-than.test.d.ts","sourceRoot":"","sources":["../../src/expect/greater-than.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/greaterThan', () => {
|
|
5
|
+
it('should not throw when expectation is smaller than actual', () => {
|
|
6
|
+
(0, expect_1.expect)(1).to.be.greaterThan(0);
|
|
7
|
+
});
|
|
8
|
+
it('should throw when expectation is bigger than actual', () => {
|
|
9
|
+
(0, expect_1.expect)(() => {
|
|
10
|
+
(0, expect_1.expect)(1).to.be.greaterThan(2);
|
|
11
|
+
}).to.throw();
|
|
12
|
+
});
|
|
13
|
+
it('should work with dates', () => {
|
|
14
|
+
(0, expect_1.expect)(new Date(1)).to.be.gt(new Date(0));
|
|
15
|
+
});
|
|
16
|
+
describe('not', () => {
|
|
17
|
+
it('should invert the assertion', () => {
|
|
18
|
+
(0, expect_1.expect)(() => {
|
|
19
|
+
(0, expect_1.expect)(1).not.to.be.greaterThan(0);
|
|
20
|
+
}).to.throw();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=greater-than.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greater-than.test.js","sourceRoot":"","sources":["../../src/expect/greater-than.test.ts"],"names":[],"mappings":";;AAAA,sCAAmC;AAEnC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAChE,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC3D,IAAA,eAAM,EAAC,GAAG,EAAE;YACR,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAC9B,IAAA,eAAM,EAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACjB,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACnC,IAAA,eAAM,EAAC,GAAG,EAAE;gBACR,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAClB,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":""}
|