@plugjs/expect5 0.4.5 → 0.4.7
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/cli.mjs +1 -1
- package/dist/expectation/async.cjs +32 -20
- package/dist/expectation/async.cjs.map +1 -1
- package/dist/expectation/async.d.ts +51 -11
- package/dist/expectation/async.mjs +32 -20
- package/dist/expectation/async.mjs.map +1 -1
- package/dist/expectation/expect.cjs +3 -3
- package/dist/expectation/expect.cjs.map +1 -1
- package/dist/expectation/expect.d.ts +3 -3
- package/dist/expectation/expect.mjs +4 -4
- package/dist/expectation/expect.mjs.map +1 -1
- package/dist/expectation/expectations.cjs +27 -44
- package/dist/expectation/expectations.cjs.map +1 -1
- package/dist/expectation/expectations.d.ts +72 -14
- package/dist/expectation/expectations.mjs +27 -44
- package/dist/expectation/expectations.mjs.map +1 -1
- package/dist/expectation/matchers.cjs +24 -47
- package/dist/expectation/matchers.cjs.map +1 -1
- package/dist/expectation/matchers.d.ts +136 -93
- package/dist/expectation/matchers.mjs +23 -46
- package/dist/expectation/matchers.mjs.map +1 -1
- package/dist/expectation/types.cjs.map +1 -1
- package/dist/expectation/types.d.ts +2 -2
- package/dist/expectation/types.mjs.map +1 -1
- package/dist/test.cjs +6 -4
- package/dist/test.cjs.map +1 -1
- package/dist/test.mjs +7 -5
- package/dist/test.mjs.map +1 -1
- package/package.json +3 -3
- package/src/expectation/async.ts +95 -14
- package/src/expectation/expect.ts +6 -6
- package/src/expectation/expectations.ts +152 -27
- package/src/expectation/matchers.ts +207 -125
- package/src/expectation/types.ts +2 -2
- package/src/test.ts +9 -4
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { type Diff } from './diff';
|
|
2
|
-
import { type
|
|
2
|
+
import { type Matcher } from './matchers';
|
|
3
3
|
import { type Constructor, type TypeMappings, type TypeName } from './types';
|
|
4
4
|
/** An assertion function, for sub-expectations and value introspection */
|
|
5
5
|
export type AssertionFunction<T = unknown> = (assert: Expectations<T>) => void | Expectations;
|
|
6
6
|
/** Return the type asserted by an {@link AssertionFunction} or `T` */
|
|
7
7
|
export type AssertedType<T, F extends AssertionFunction<any>, R = ReturnType<F>> = R extends Expectations<infer I> ? unknown extends I ? T : I : T;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/** Infer the type of a {@link Matcher} */
|
|
9
|
+
export type InferMatcher<T, M extends Matcher> = M extends Matcher<infer I> ? unknown extends I ? T : T & I : never;
|
|
10
|
+
/** Recursively infer the type of a {@link Matcher} in a `Record` */
|
|
11
|
+
export type InferToEqual<T> = T extends Matcher<infer V> ? V : T extends Record<any, any> ? {
|
|
12
|
+
[k in keyof T]: InferToEqual<T[k]>;
|
|
10
13
|
} : T;
|
|
11
14
|
/** Simple wrapper defining the _parent_ instance of an {@link Expectations}. */
|
|
12
|
-
type ExpectationsParent = {
|
|
15
|
+
export type ExpectationsParent = {
|
|
13
16
|
/** Parent {@link Expectations} instance */
|
|
14
17
|
expectations: Expectations;
|
|
15
18
|
/** Property associating _this_ to the parent */
|
|
@@ -46,13 +49,26 @@ export declare class Expectations<T = unknown> {
|
|
|
46
49
|
parent?: ExpectationsParent | undefined);
|
|
47
50
|
/** Throw an {@link ExpectationError} associated with _this_ */
|
|
48
51
|
protected _fail(details: string, diff?: Diff): never;
|
|
52
|
+
/**
|
|
53
|
+
* Expects the value to be of the specified _extended_ {@link TypeName type}.
|
|
54
|
+
*
|
|
55
|
+
* Negation: {@link NegativeExpectations.toBeA `not.toBeA(...)`}
|
|
56
|
+
*/
|
|
57
|
+
toBeA<Name extends TypeName>(type: Name): Expectations<TypeMappings[Name]>;
|
|
58
|
+
/**
|
|
59
|
+
* Expects the value to be of the specified _extended_ {@link TypeName type},
|
|
60
|
+
* and further validates it with a {@link Matcher}.
|
|
61
|
+
*
|
|
62
|
+
* Negation: {@link NegativeExpectations.toBeA `not.toBeA(...)`}
|
|
63
|
+
*/
|
|
64
|
+
toBeA<Name extends TypeName, Mapped extends TypeMappings[Name], Match extends Matcher>(type: Name, matcher: Match): Expectations<InferMatcher<Mapped, Match>>;
|
|
49
65
|
/**
|
|
50
66
|
* Expects the value to be of the specified _extended_ {@link TypeName type},
|
|
51
|
-
* and
|
|
67
|
+
* and further asserts it with an {@link AssertionFunction}.
|
|
52
68
|
*
|
|
53
69
|
* Negation: {@link NegativeExpectations.toBeA `not.toBeA(...)`}
|
|
54
70
|
*/
|
|
55
|
-
toBeA<Name extends TypeName, Mapped extends TypeMappings[Name], Assert extends AssertionFunction<Mapped>>(type: Name, assertion
|
|
71
|
+
toBeA<Name extends TypeName, Mapped extends TypeMappings[Name], Assert extends AssertionFunction<Mapped>>(type: Name, assertion: Assert): Expectations<AssertedType<Mapped, Assert>>;
|
|
56
72
|
/**
|
|
57
73
|
* Expects the value to be a `number` within a given +/- _delta_ range of the
|
|
58
74
|
* specified expected value.
|
|
@@ -124,13 +140,26 @@ export declare class Expectations<T = unknown> {
|
|
|
124
140
|
* Negation: {@link Expectations.toBeLessThan `toBeLessThan(...)`}
|
|
125
141
|
*/
|
|
126
142
|
toBeGreaterThanOrEqual(value: bigint): Expectations<bigint>;
|
|
143
|
+
/**
|
|
144
|
+
* Expects the value to be an instance of the specified {@link Constructor}.
|
|
145
|
+
*
|
|
146
|
+
* Negation: {@link NegativeExpectations.toBeInstanceOf `not.toInstanceOf(...)`}
|
|
147
|
+
*/
|
|
148
|
+
toBeInstanceOf<Class extends Constructor>(constructor: Class): Expectations<InstanceType<Class>>;
|
|
127
149
|
/**
|
|
128
150
|
* Expects the value to be an instance of the specified {@link Constructor},
|
|
129
|
-
* and
|
|
151
|
+
* and further validates it with a {@link Matcher}.
|
|
130
152
|
*
|
|
131
153
|
* Negation: {@link NegativeExpectations.toBeInstanceOf `not.toInstanceOf(...)`}
|
|
132
154
|
*/
|
|
133
|
-
toBeInstanceOf<Class extends Constructor,
|
|
155
|
+
toBeInstanceOf<Class extends Constructor, Match extends Matcher>(constructor: Class, matcher: Match): Expectations<InferMatcher<InstanceType<Class>, Match>>;
|
|
156
|
+
/**
|
|
157
|
+
* Expects the value to be an instance of the specified {@link Constructor},
|
|
158
|
+
* and further asserts it with an {@link AssertionFunction}.
|
|
159
|
+
*
|
|
160
|
+
* Negation: {@link NegativeExpectations.toBeInstanceOf `not.toInstanceOf(...)`}
|
|
161
|
+
*/
|
|
162
|
+
toBeInstanceOf<Class extends Constructor, Assert extends AssertionFunction<InstanceType<Class>>>(constructor: Class, assertion: Assert): Expectations<AssertedType<InstanceType<Class>, Assert>>;
|
|
134
163
|
/**
|
|
135
164
|
* Expects the value to be a `number` less than the specified expected value.
|
|
136
165
|
*
|
|
@@ -194,7 +223,7 @@ export declare class Expectations<T = unknown> {
|
|
|
194
223
|
*
|
|
195
224
|
* Negation: {@link NegativeExpectations.toEqual `not.toEqual(...)`}
|
|
196
225
|
*/
|
|
197
|
-
toEqual<Type>(expected: Type): Expectations<
|
|
226
|
+
toEqual<Type>(expected: Type): Expectations<InferToEqual<Type>>;
|
|
198
227
|
/**
|
|
199
228
|
* Expects the value to have a `number` _property_ `length` with the specified
|
|
200
229
|
* expected value.
|
|
@@ -204,13 +233,30 @@ export declare class Expectations<T = unknown> {
|
|
|
204
233
|
toHaveLength(length: number): Expectations<T & {
|
|
205
234
|
length: number;
|
|
206
235
|
}>;
|
|
236
|
+
/**
|
|
237
|
+
* Expects the value to have the specified _property_.
|
|
238
|
+
*
|
|
239
|
+
* Negation: {@link NegativeExpectations.toHaveProperty `not.toHaveProperty(...)`}
|
|
240
|
+
*/
|
|
241
|
+
toHaveProperty<Prop extends string | number | symbol>(property: Prop): Expectations<T & {
|
|
242
|
+
[keyt in Prop]: unknown;
|
|
243
|
+
}>;
|
|
244
|
+
/**
|
|
245
|
+
* Expects the value to have the specified _property_ and (if specified)
|
|
246
|
+
* further validates its value with a {@link Matcher}.
|
|
247
|
+
*
|
|
248
|
+
* Negation: {@link NegativeExpectations.toHaveProperty `not.toHaveProperty(...)`}
|
|
249
|
+
*/
|
|
250
|
+
toHaveProperty<Prop extends string | number | symbol, Match extends Matcher>(property: Prop, matcher: Match): Expectations<T & {
|
|
251
|
+
[keyt in Prop]: InferMatcher<unknown, Match>;
|
|
252
|
+
}>;
|
|
207
253
|
/**
|
|
208
254
|
* Expects the value to have the specified _property_ and (if specified)
|
|
209
255
|
* further asserts its value with an {@link AssertionFunction}.
|
|
210
256
|
*
|
|
211
257
|
* Negation: {@link NegativeExpectations.toHaveProperty `not.toHaveProperty(...)`}
|
|
212
258
|
*/
|
|
213
|
-
toHaveProperty<Prop extends string | number | symbol, Assert extends AssertionFunction>(property: Prop, assertion
|
|
259
|
+
toHaveProperty<Prop extends string | number | symbol, Assert extends AssertionFunction>(property: Prop, assertion: Assert): Expectations<T & {
|
|
214
260
|
[keyt in Prop]: AssertedType<unknown, Assert>;
|
|
215
261
|
}>;
|
|
216
262
|
/**
|
|
@@ -271,12 +317,25 @@ export declare class Expectations<T = unknown> {
|
|
|
271
317
|
*/
|
|
272
318
|
toStrictlyEqual<Type>(expected: Type): Expectations<Type>;
|
|
273
319
|
/**
|
|
274
|
-
* Expects the value to be a `function` throwing
|
|
275
|
-
*
|
|
320
|
+
* Expects the value to be a `function` throwing.
|
|
321
|
+
*
|
|
322
|
+
* Negation: {@link NegativeExpectations.toThrow `not.toThrow()`}
|
|
323
|
+
*/
|
|
324
|
+
toThrow(): Expectations<() => any>;
|
|
325
|
+
/**
|
|
326
|
+
* Expects the value to be a `function` throwing, and further validates the
|
|
327
|
+
* thrown value with a {@link Matcher}.
|
|
328
|
+
*
|
|
329
|
+
* Negation: {@link NegativeExpectations.toThrow `not.toThrow()`}
|
|
330
|
+
*/
|
|
331
|
+
toThrow(matcher: Matcher): Expectations<() => any>;
|
|
332
|
+
/**
|
|
333
|
+
* Expects the value to be a `function` throwing, and further asserts the
|
|
334
|
+
* thrown value with an {@link AssertionFunction}.
|
|
276
335
|
*
|
|
277
336
|
* Negation: {@link NegativeExpectations.toThrow `not.toThrow()`}
|
|
278
337
|
*/
|
|
279
|
-
toThrow(assert
|
|
338
|
+
toThrow(assert: AssertionFunction): Expectations<() => any>;
|
|
280
339
|
/**
|
|
281
340
|
* Expects the value to be a `function` throwing an {@link Error}.
|
|
282
341
|
*
|
|
@@ -451,4 +510,3 @@ export declare class NegativeExpectations<T = unknown> {
|
|
|
451
510
|
*/
|
|
452
511
|
toStrictlyEqual(expected: any): Expectations<T>;
|
|
453
512
|
}
|
|
454
|
-
export {};
|
|
@@ -28,19 +28,13 @@ var Expectations = class {
|
|
|
28
28
|
_fail(details, diff2) {
|
|
29
29
|
throw new ExpectationError(this, details, diff2);
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
* BASIC *
|
|
33
|
-
* ------------------------------------------------------------------------ */
|
|
34
|
-
/**
|
|
35
|
-
* Expects the value to be of the specified _extended_ {@link TypeName type},
|
|
36
|
-
* and (if specified) further asserts it with an {@link AssertionFunction}.
|
|
37
|
-
*
|
|
38
|
-
* Negation: {@link NegativeExpectations.toBeA `not.toBeA(...)`}
|
|
39
|
-
*/
|
|
40
|
-
toBeA(type, assertion) {
|
|
31
|
+
toBeA(type, assertionOrMatcher) {
|
|
41
32
|
if (typeOf(this.value) === type) {
|
|
42
|
-
if (
|
|
43
|
-
|
|
33
|
+
if (isMatcher(assertionOrMatcher)) {
|
|
34
|
+
assertionOrMatcher.expect(this.value);
|
|
35
|
+
} else if (assertionOrMatcher) {
|
|
36
|
+
assertionOrMatcher(this);
|
|
37
|
+
}
|
|
44
38
|
return this;
|
|
45
39
|
}
|
|
46
40
|
this._fail(`to be ${prefixType(type)}`);
|
|
@@ -103,17 +97,13 @@ var Expectations = class {
|
|
|
103
97
|
return this;
|
|
104
98
|
this._fail(`to be greater than or equal to ${stringifyValue(value)}`);
|
|
105
99
|
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Expects the value to be an instance of the specified {@link Constructor},
|
|
109
|
-
* and (if specified) further asserts it with an {@link AssertionFunction}.
|
|
110
|
-
*
|
|
111
|
-
* Negation: {@link NegativeExpectations.toBeInstanceOf `not.toInstanceOf(...)`}
|
|
112
|
-
*/
|
|
113
|
-
toBeInstanceOf(constructor, assertion) {
|
|
100
|
+
toBeInstanceOf(constructor, assertionOrMatcher) {
|
|
114
101
|
if (this.value instanceof constructor) {
|
|
115
|
-
if (
|
|
116
|
-
|
|
102
|
+
if (isMatcher(assertionOrMatcher)) {
|
|
103
|
+
assertionOrMatcher.expect(this.value);
|
|
104
|
+
} else if (assertionOrMatcher) {
|
|
105
|
+
assertionOrMatcher(this);
|
|
106
|
+
}
|
|
117
107
|
return this;
|
|
118
108
|
}
|
|
119
109
|
this._fail(`to be an instance of ${stringifyConstructor(constructor)}`);
|
|
@@ -217,24 +207,21 @@ var Expectations = class {
|
|
|
217
207
|
}
|
|
218
208
|
return this;
|
|
219
209
|
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Expects the value to have the specified _property_ and (if specified)
|
|
223
|
-
* further asserts its value with an {@link AssertionFunction}.
|
|
224
|
-
*
|
|
225
|
-
* Negation: {@link NegativeExpectations.toHaveProperty `not.toHaveProperty(...)`}
|
|
226
|
-
*/
|
|
227
|
-
toHaveProperty(property, assertion) {
|
|
210
|
+
toHaveProperty(property, assertionOrMatcher) {
|
|
228
211
|
this.toBeDefined();
|
|
229
212
|
const propertyValue = this.value[property];
|
|
230
213
|
if (propertyValue === void 0) {
|
|
231
214
|
this._fail(`to have property "${String(property)}"`);
|
|
232
215
|
}
|
|
233
|
-
if (
|
|
216
|
+
if (assertionOrMatcher) {
|
|
217
|
+
const parent = { expectations: this, prop: property };
|
|
234
218
|
try {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
219
|
+
if (isMatcher(assertionOrMatcher)) {
|
|
220
|
+
assertionOrMatcher.expect(propertyValue, parent);
|
|
221
|
+
} else if (assertionOrMatcher) {
|
|
222
|
+
const expectations = new Expectations(propertyValue, this.remarks, parent);
|
|
223
|
+
assertionOrMatcher(expectations);
|
|
224
|
+
}
|
|
238
225
|
} catch (error) {
|
|
239
226
|
if (error instanceof ExpectationError && error.diff) {
|
|
240
227
|
error.diff = {
|
|
@@ -304,22 +291,18 @@ var Expectations = class {
|
|
|
304
291
|
const diff2 = { diff: true, value: this.value, expected };
|
|
305
292
|
this._fail(`to strictly equal ${stringifyValue(expected)}`, diff2);
|
|
306
293
|
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Expects the value to be a `function` throwing, and (if specified) further
|
|
310
|
-
* asserts the thrown value with an {@link AssertionFunction}.
|
|
311
|
-
*
|
|
312
|
-
* Negation: {@link NegativeExpectations.toThrow `not.toThrow()`}
|
|
313
|
-
*/
|
|
314
|
-
toThrow(assert) {
|
|
294
|
+
toThrow(assertionOrMatcher) {
|
|
315
295
|
const func = this.toBeA("function");
|
|
316
296
|
let passed = false;
|
|
317
297
|
try {
|
|
318
298
|
func.value();
|
|
319
299
|
passed = true;
|
|
320
300
|
} catch (thrown) {
|
|
321
|
-
if (
|
|
322
|
-
|
|
301
|
+
if (isMatcher(assertionOrMatcher)) {
|
|
302
|
+
assertionOrMatcher.expect(thrown);
|
|
303
|
+
} else if (assertionOrMatcher) {
|
|
304
|
+
assertionOrMatcher(new Expectations(thrown, this.remarks));
|
|
305
|
+
}
|
|
323
306
|
}
|
|
324
307
|
if (passed)
|
|
325
308
|
this._fail("to throw");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/expectation/expectations.ts"],
|
|
4
|
-
"mappings": ";AAAA,SAAS,YAAuB;AAChC,SAAS,WAAW,uBAAuB;AAE3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;
|
|
4
|
+
"mappings": ";AAAA,SAAS,YAAuB;AAChC,SAAS,WAAW,uBAAuB;AAE3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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Aa,MAAM;AAC5B,WAAK,MAAM,oBAAoB,MAAM;AAAA,IACvC;AAEA,WAAO,KAAK;AAAA,EACd;AAAA,EAuCA,UACI,UACY;AACd,cAAU,KAAK,eAAe,MAAM,QAAQ;AAC5C,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,QAAQ,SAAgD;AACtD,UAAM,eAAe,KAAK,cAAc,MAAM,QAAQ;AAEtD,QAAI,CAAE,aAAa,MAAM,MAAM,OAAO;AAAG,aAAO;AAEhD,SAAK,MAAM,gBAAgB,eAAe,OAAO,GAAG;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,UAAmC;AACjC,UAAM,eAAe,KAAK,cAAc,MAAM,UAAU;AAExD,QAAI;AACF,mBAAa,MAAM;AACnB,aAAO;AAAA,IACT,SAAS,QAAP;AACA,WAAK,MAAM,cAAc;AAAA,IAC3B;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,gBAAgB,UAAgC;AAC9C,QAAI,KAAK,WAAW;AAAU,aAAO,KAAK;AAC1C,SAAK,MAAM,yBAAyB,eAAe,QAAQ,GAAG;AAAA,EAChE;AACF;",
|
|
5
5
|
"names": ["diff"]
|
|
6
6
|
}
|
|
@@ -20,13 +20,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// expectation/matchers.ts
|
|
21
21
|
var matchers_exports = {};
|
|
22
22
|
__export(matchers_exports, {
|
|
23
|
-
|
|
23
|
+
Matcher: () => Matcher,
|
|
24
24
|
NegativeMatchers: () => NegativeMatchers
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(matchers_exports);
|
|
27
27
|
var import_expectations = require("./expectations.cjs");
|
|
28
28
|
var import_types = require("./types.cjs");
|
|
29
|
-
var
|
|
29
|
+
var Matcher = class {
|
|
30
30
|
_matchers;
|
|
31
31
|
not;
|
|
32
32
|
constructor() {
|
|
@@ -34,32 +34,23 @@ var Matchers = class {
|
|
|
34
34
|
this.not = new NegativeMatchers(this, matchers);
|
|
35
35
|
this._matchers = matchers;
|
|
36
36
|
}
|
|
37
|
-
expect(value) {
|
|
38
|
-
let expectations = new import_expectations.Expectations(value, void 0);
|
|
37
|
+
expect(value, parent) {
|
|
38
|
+
let expectations = new import_expectations.Expectations(value, void 0, parent);
|
|
39
39
|
for (const matcher of this._matchers) {
|
|
40
40
|
expectations = matcher(expectations);
|
|
41
41
|
}
|
|
42
42
|
return expectations.value;
|
|
43
43
|
}
|
|
44
44
|
_push(matcher) {
|
|
45
|
-
const matchers = new
|
|
45
|
+
const matchers = new Matcher();
|
|
46
46
|
matchers._matchers.push(...this._matchers, matcher);
|
|
47
47
|
return matchers;
|
|
48
48
|
}
|
|
49
49
|
static {
|
|
50
50
|
this.prototype[import_types.matcherMarker] = import_types.matcherMarker;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* ------------------------------------------------------------------------ */
|
|
55
|
-
/**
|
|
56
|
-
* Expects the value to be of the specified _extended_ {@link TypeName type},
|
|
57
|
-
* and (if specified) further asserts it with an {@link AssertionFunction}.
|
|
58
|
-
*
|
|
59
|
-
* Negation: {@link NegativeMatchers.toBeA `not.toBeA(...)`}
|
|
60
|
-
*/
|
|
61
|
-
toBeA(type, assertion) {
|
|
62
|
-
return this._push((e) => e.toBeA(type, assertion));
|
|
52
|
+
toBeA(type, assertionOrMatcher) {
|
|
53
|
+
return this._push((e) => e.toBeA(type, assertionOrMatcher));
|
|
63
54
|
}
|
|
64
55
|
/**
|
|
65
56
|
* Expects the value to be a `number` or `bigint` within a given +/- _delta_
|
|
@@ -92,7 +83,7 @@ var Matchers = class {
|
|
|
92
83
|
/**
|
|
93
84
|
* Expects the value to be _falsy_ (zero, empty string, `false`, ...).
|
|
94
85
|
*
|
|
95
|
-
* Negation: {@link
|
|
86
|
+
* Negation: {@link Matcher.toBeTruthy `toBeTruthy()`}
|
|
96
87
|
*/
|
|
97
88
|
toBeFalsy() {
|
|
98
89
|
return this._push((e) => e.toBeFalsy());
|
|
@@ -103,15 +94,8 @@ var Matchers = class {
|
|
|
103
94
|
toBeGreaterThanOrEqual(value) {
|
|
104
95
|
return this._push((e) => e.toBeGreaterThanOrEqual(value));
|
|
105
96
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
* Expects the value to be an instance of the specified {@link Constructor},
|
|
109
|
-
* and (if specified) further asserts it with an {@link AssertionFunction}.
|
|
110
|
-
*
|
|
111
|
-
* Negation: {@link NegativeMatchers.toBeInstanceOf `not.toInstanceOf(...)`}
|
|
112
|
-
*/
|
|
113
|
-
toBeInstanceOf(constructor, assertion) {
|
|
114
|
-
return this._push((e) => e.toBeInstanceOf(constructor, assertion));
|
|
97
|
+
toBeInstanceOf(constructor, assertionOrMatcher) {
|
|
98
|
+
return this._push((e) => e.toBeInstanceOf(constructor, assertionOrMatcher));
|
|
115
99
|
}
|
|
116
100
|
toBeLessThan(value) {
|
|
117
101
|
return this._push((e) => e.toBeLessThan(value));
|
|
@@ -142,7 +126,7 @@ var Matchers = class {
|
|
|
142
126
|
/**
|
|
143
127
|
* Expects the value to be _falsy_ (non-zero, non-empty string, ...).
|
|
144
128
|
*
|
|
145
|
-
* Negation: {@link
|
|
129
|
+
* Negation: {@link Matcher.toBeFalsy `toBeFalsy()`}
|
|
146
130
|
*/
|
|
147
131
|
toBeTruthy() {
|
|
148
132
|
return this._push((e) => e.toBeTruthy());
|
|
@@ -180,15 +164,8 @@ var Matchers = class {
|
|
|
180
164
|
toHaveLength(length) {
|
|
181
165
|
return this._push((e) => e.toHaveLength(length));
|
|
182
166
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
* Expects the value to have the specified _property_ and (if specified)
|
|
186
|
-
* further asserts its value with an {@link AssertionFunction}.
|
|
187
|
-
*
|
|
188
|
-
* Negation: {@link NegativeMatchers.toHaveProperty `not.toHaveProperty(...)`}
|
|
189
|
-
*/
|
|
190
|
-
toHaveProperty(property, assertion) {
|
|
191
|
-
return this._push((e) => e.toHaveProperty(property, assertion));
|
|
167
|
+
toHaveProperty(property, assertionOrMatcher) {
|
|
168
|
+
return this._push((e) => e.toHaveProperty(property, assertionOrMatcher));
|
|
192
169
|
}
|
|
193
170
|
/* ------------------------------------------------------------------------ */
|
|
194
171
|
/**
|
|
@@ -240,7 +217,7 @@ var NegativeMatchers = class {
|
|
|
240
217
|
* Expects the value _**NOT**_ to be of the specified _extended_
|
|
241
218
|
* {@link TypeName type}.
|
|
242
219
|
*
|
|
243
|
-
* Negates: {@link
|
|
220
|
+
* Negates: {@link Matcher.toBeA `toBeA(...)`}
|
|
244
221
|
*/
|
|
245
222
|
toBeA(type) {
|
|
246
223
|
return this._push((e) => e.toBeA(type));
|
|
@@ -252,7 +229,7 @@ var NegativeMatchers = class {
|
|
|
252
229
|
/**
|
|
253
230
|
* Expects the value to be either `null` or `undefined`.
|
|
254
231
|
*
|
|
255
|
-
* Negates: {@link
|
|
232
|
+
* Negates: {@link Matcher.toBeDefined `toBeDefined()`}
|
|
256
233
|
*/
|
|
257
234
|
toBeDefined() {
|
|
258
235
|
return this._push((e) => e.toBeDefined());
|
|
@@ -262,7 +239,7 @@ var NegativeMatchers = class {
|
|
|
262
239
|
* Expects the value _**NOT**_ to be an instance of the specified
|
|
263
240
|
* {@link Constructor}.
|
|
264
241
|
*
|
|
265
|
-
* Negates: {@link
|
|
242
|
+
* Negates: {@link Matcher.toBeInstanceOf `toBeInstanceOf(...)`}
|
|
266
243
|
*/
|
|
267
244
|
toBeInstanceOf(constructor) {
|
|
268
245
|
return this._push((e) => e.toBeInstanceOf(constructor));
|
|
@@ -271,7 +248,7 @@ var NegativeMatchers = class {
|
|
|
271
248
|
/**
|
|
272
249
|
* Expects the value _**NOT**_ to be `NaN`.
|
|
273
250
|
*
|
|
274
|
-
* Negates: {@link
|
|
251
|
+
* Negates: {@link Matcher.toBeNaN `toBeNaN()`}
|
|
275
252
|
*/
|
|
276
253
|
toBeNaN() {
|
|
277
254
|
return this._push((e) => e.toBeNaN());
|
|
@@ -284,7 +261,7 @@ var NegativeMatchers = class {
|
|
|
284
261
|
* Expects the value _**NOT**_ to be _deep equal to_ the specified expected
|
|
285
262
|
* one.
|
|
286
263
|
*
|
|
287
|
-
* Negates: {@link
|
|
264
|
+
* Negates: {@link Matcher.toEqual `toEqual(...)`}
|
|
288
265
|
*/
|
|
289
266
|
toEqual(expected) {
|
|
290
267
|
return this._push((e) => e.toEqual(expected));
|
|
@@ -294,7 +271,7 @@ var NegativeMatchers = class {
|
|
|
294
271
|
* Expects the value to have a `number` _property_ `length` _different_ from
|
|
295
272
|
* the specified expected value.
|
|
296
273
|
*
|
|
297
|
-
* Negates: {@link
|
|
274
|
+
* Negates: {@link Matcher.toHaveLength `toHaveLength(...)`}
|
|
298
275
|
*/
|
|
299
276
|
toHaveLength(length) {
|
|
300
277
|
return this._push((e) => e.toHaveLength(length));
|
|
@@ -303,7 +280,7 @@ var NegativeMatchers = class {
|
|
|
303
280
|
/**
|
|
304
281
|
* Expects the value _**NOT**_ to have the specified _property_.
|
|
305
282
|
*
|
|
306
|
-
* Negates: {@link
|
|
283
|
+
* Negates: {@link Matcher.toHaveProperty `toHaveProperty(...)`}
|
|
307
284
|
*/
|
|
308
285
|
toHaveProperty(property) {
|
|
309
286
|
return this._push((e) => e.toHaveProperty(property));
|
|
@@ -313,7 +290,7 @@ var NegativeMatchers = class {
|
|
|
313
290
|
* Expects the value to have a `number` _property_ `size` _different_ from
|
|
314
291
|
* the specified expected value.
|
|
315
292
|
*
|
|
316
|
-
* Negates: {@link
|
|
293
|
+
* Negates: {@link Matcher.toHaveSize `toHaveSize(...)`}
|
|
317
294
|
*/
|
|
318
295
|
toHaveSize(size) {
|
|
319
296
|
return this._push((e) => e.toHaveSize(size));
|
|
@@ -326,7 +303,7 @@ var NegativeMatchers = class {
|
|
|
326
303
|
* Expects the value to be a `string` _**NOT MATCHING**_ the specified
|
|
327
304
|
* sub-`string` or {@link RegExp}.
|
|
328
305
|
*
|
|
329
|
-
* Negates: {@link
|
|
306
|
+
* Negates: {@link Matcher.toMatch `toMatch(...)`}
|
|
330
307
|
*/
|
|
331
308
|
toMatch(matcher) {
|
|
332
309
|
return this._push((e) => e.toMatch(matcher));
|
|
@@ -336,7 +313,7 @@ var NegativeMatchers = class {
|
|
|
336
313
|
* Expects the value _**NOT**_ to be _strictly equal to_ the specified
|
|
337
314
|
* expected one.
|
|
338
315
|
*
|
|
339
|
-
* Negates: {@link
|
|
316
|
+
* Negates: {@link Matcher.toStrictlyEqual `toStrictlyEqual(...)`}
|
|
340
317
|
*/
|
|
341
318
|
toStrictlyEqual(expected) {
|
|
342
319
|
return this._push((e) => e.toStrictlyEqual(expected));
|
|
@@ -344,7 +321,7 @@ var NegativeMatchers = class {
|
|
|
344
321
|
};
|
|
345
322
|
// Annotate the CommonJS export names for ESM import in node:
|
|
346
323
|
0 && (module.exports = {
|
|
347
|
-
|
|
324
|
+
Matcher,
|
|
348
325
|
NegativeMatchers
|
|
349
326
|
});
|
|
350
327
|
//# sourceMappingURL=matchers.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/expectation/matchers.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAQO;AACP,mBAKO;AASA,IAAM,UAAN,MAA2B;AAAA,EACf;AAAA,EACR;AAAA,EAET,cAAc;AACZ,UAAM,WAAsC,CAAC;AAC7C,SAAK,MAAM,IAAI,iBAAiB,MAAM,QAAQ;AAC9C,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA,OAAO,OAAgB,QAAgC;AACrD,QAAI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