@plugjs/expect5 0.4.6 → 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 +14 -22
- package/dist/expectation/async.cjs.map +1 -1
- package/dist/expectation/async.d.ts +39 -13
- package/dist/expectation/async.mjs +14 -22
- 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 +5 -2
- package/dist/test.cjs.map +1 -1
- package/dist/test.mjs +6 -3
- package/dist/test.mjs.map +1 -1
- package/package.json +3 -3
- package/src/expectation/async.ts +69 -17
- 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 +8 -2
|
@@ -1,46 +1,59 @@
|
|
|
1
|
-
import { Expectations, type AssertedType, type AssertionFunction, type
|
|
1
|
+
import { Expectations, type AssertedType, type AssertionFunction, type ExpectationsParent, type InferMatcher, type InferToEqual } from './expectations';
|
|
2
2
|
import { type Constructor, type TypeMappings, type TypeName } from './types';
|
|
3
|
-
type
|
|
4
|
-
export declare class
|
|
3
|
+
type PositiveMatcherFunction = (expectations: Expectations) => Expectations;
|
|
4
|
+
export declare class Matcher<T = unknown> {
|
|
5
5
|
private readonly _matchers;
|
|
6
6
|
readonly not: NegativeMatchers<T>;
|
|
7
7
|
constructor();
|
|
8
|
-
expect(value: unknown): T;
|
|
8
|
+
expect(value: unknown, parent?: ExpectationsParent): T;
|
|
9
9
|
private _push;
|
|
10
10
|
/**
|
|
11
|
-
* Expects the value to be of the specified _extended_ {@link TypeName type}
|
|
12
|
-
* and (if specified) further asserts it with an {@link AssertionFunction}.
|
|
11
|
+
* Expects the value to be of the specified _extended_ {@link TypeName type}.
|
|
13
12
|
*
|
|
14
|
-
* Negation: {@link
|
|
13
|
+
* Negation: {@link NegativeExpectations.toBeA `not.toBeA(...)`}
|
|
15
14
|
*/
|
|
16
|
-
toBeA<Name extends TypeName
|
|
15
|
+
toBeA<Name extends TypeName>(type: Name): Matcher<TypeMappings[Name]>;
|
|
16
|
+
/**
|
|
17
|
+
* Expects the value to be of the specified _extended_ {@link TypeName type},
|
|
18
|
+
* and further validates it with a {@link Matcher}.
|
|
19
|
+
*
|
|
20
|
+
* Negation: {@link NegativeExpectations.toBeA `not.toBeA(...)`}
|
|
21
|
+
*/
|
|
22
|
+
toBeA<Name extends TypeName, Mapped extends TypeMappings[Name], Match extends Matcher>(type: Name, matcher: Match): Matcher<InferMatcher<Mapped, Match>>;
|
|
23
|
+
/**
|
|
24
|
+
* Expects the value to be of the specified _extended_ {@link TypeName type},
|
|
25
|
+
* and further asserts it with an {@link AssertionFunction}.
|
|
26
|
+
*
|
|
27
|
+
* Negation: {@link NegativeExpectations.toBeA `not.toBeA(...)`}
|
|
28
|
+
*/
|
|
29
|
+
toBeA<Name extends TypeName, Mapped extends TypeMappings[Name], Assert extends AssertionFunction<Mapped>>(type: Name, assertion: Assert): Matcher<AssertedType<Mapped, Assert>>;
|
|
17
30
|
/**
|
|
18
31
|
* Expects the value to be a `number` within a given +/- _delta_ range of the
|
|
19
32
|
* specified expected value.
|
|
20
33
|
*
|
|
21
34
|
* Negation: {@link NegativeMatchers.toBeCloseTo `not.toBeCloseTo(...)`}
|
|
22
35
|
*/
|
|
23
|
-
toBeCloseTo(value: number, delta: number):
|
|
36
|
+
toBeCloseTo(value: number, delta: number): Matcher<number>;
|
|
24
37
|
/**
|
|
25
38
|
* Expects the value to be a `bigint` within a given +/- _delta_ range of the
|
|
26
39
|
* specified expected value.
|
|
27
40
|
*
|
|
28
41
|
* Negation: {@link NegativeMatchers.toBeCloseTo `not.toBeCloseTo(...)`}
|
|
29
42
|
*/
|
|
30
|
-
toBeCloseTo(value: bigint, delta: bigint):
|
|
43
|
+
toBeCloseTo(value: bigint, delta: bigint): Matcher<bigint>;
|
|
31
44
|
/**
|
|
32
45
|
* Expects the value to be neither `null` nor `undefined`.
|
|
33
46
|
*
|
|
34
47
|
* Negation: {@link NegativeMatchers.toBeDefined `not.toBeDefined()`}
|
|
35
48
|
*/
|
|
36
|
-
toBeDefined():
|
|
49
|
+
toBeDefined(): Matcher<T>;
|
|
37
50
|
/**
|
|
38
51
|
* Expect the value to be an instance of {@link Error}.
|
|
39
52
|
*
|
|
40
53
|
* If specified, the {@link Error}'s own message will be further expected to
|
|
41
54
|
* either match the specified {@link RegExp}, or equal the specified `string`.
|
|
42
55
|
*/
|
|
43
|
-
toBeError(message?: string | RegExp):
|
|
56
|
+
toBeError(message?: string | RegExp): Matcher<Error>;
|
|
44
57
|
/**
|
|
45
58
|
* Expect the value to be an instance of {@link Error} and further asserts
|
|
46
59
|
* it to be an instance of the specifed {@link Error} {@link Constructor}.
|
|
@@ -48,130 +61,160 @@ export declare class Matchers<T = unknown> {
|
|
|
48
61
|
* If specified, the {@link Error}'s own message will be further expected to
|
|
49
62
|
* either match the specified {@link RegExp}, or equal the specified `string`.
|
|
50
63
|
*/
|
|
51
|
-
toBeError<Class extends Constructor<Error>>(constructor: Class, message?: string | RegExp):
|
|
64
|
+
toBeError<Class extends Constructor<Error>>(constructor: Class, message?: string | RegExp): Matcher<InstanceType<Class>>;
|
|
52
65
|
/** Expects the value strictly equal to `false`. */
|
|
53
|
-
toBeFalse():
|
|
66
|
+
toBeFalse(): Matcher<false>;
|
|
54
67
|
/**
|
|
55
68
|
* Expects the value to be _falsy_ (zero, empty string, `false`, ...).
|
|
56
69
|
*
|
|
57
|
-
* Negation: {@link
|
|
70
|
+
* Negation: {@link Matcher.toBeTruthy `toBeTruthy()`}
|
|
58
71
|
*/
|
|
59
|
-
toBeFalsy():
|
|
72
|
+
toBeFalsy(): Matcher<T>;
|
|
60
73
|
/**
|
|
61
74
|
* Expects the value to be a `number` greater than the specified* expected
|
|
62
75
|
* value.
|
|
63
76
|
*
|
|
64
|
-
* Negation: {@link
|
|
77
|
+
* Negation: {@link Matcher.toBeLessThanOrEqual `toBeLessThanOrEqual(...)`}
|
|
65
78
|
*/
|
|
66
|
-
toBeGreaterThan(value: number):
|
|
79
|
+
toBeGreaterThan(value: number): Matcher<number>;
|
|
67
80
|
/**
|
|
68
81
|
* Expects the value to be a `bigint` greater than the specified expected
|
|
69
82
|
* value.
|
|
70
83
|
*
|
|
71
|
-
* Negation: {@link
|
|
84
|
+
* Negation: {@link Matcher.toBeLessThanOrEqual `toBeLessThanOrEqual(...)`}
|
|
72
85
|
*/
|
|
73
|
-
toBeGreaterThan(value: bigint):
|
|
86
|
+
toBeGreaterThan(value: bigint): Matcher<bigint>;
|
|
74
87
|
/**
|
|
75
88
|
* Expects the value to be a `number` greater than or equal to the specified
|
|
76
89
|
* expected value.
|
|
77
90
|
*
|
|
78
|
-
* Negation: {@link
|
|
91
|
+
* Negation: {@link Matcher.toBeLessThan `toBeLessThan(...)`}
|
|
79
92
|
*/
|
|
80
|
-
toBeGreaterThanOrEqual(value: number):
|
|
93
|
+
toBeGreaterThanOrEqual(value: number): Matcher<number>;
|
|
81
94
|
/**
|
|
82
95
|
* Expects the value to be a `bigint` greater than or equal to the specified
|
|
83
96
|
* expected value.
|
|
84
97
|
*
|
|
85
|
-
* Negation: {@link
|
|
98
|
+
* Negation: {@link Matcher.toBeLessThan `toBeLessThan(...)`}
|
|
99
|
+
*/
|
|
100
|
+
toBeGreaterThanOrEqual(value: bigint): Matcher<bigint>;
|
|
101
|
+
/**
|
|
102
|
+
* Expects the value to be an instance of the specified {@link Constructor}.
|
|
103
|
+
*
|
|
104
|
+
* Negation: {@link NegativeMatchers.toBeInstanceOf `not.toInstanceOf(...)`}
|
|
86
105
|
*/
|
|
87
|
-
|
|
106
|
+
toBeInstanceOf<Class extends Constructor>(constructor: Class): Matcher<InstanceType<Class>>;
|
|
88
107
|
/**
|
|
89
108
|
* Expects the value to be an instance of the specified {@link Constructor},
|
|
90
|
-
* and
|
|
109
|
+
* and further validates it with a {@link Matcher}.
|
|
91
110
|
*
|
|
92
111
|
* Negation: {@link NegativeMatchers.toBeInstanceOf `not.toInstanceOf(...)`}
|
|
93
112
|
*/
|
|
94
|
-
toBeInstanceOf<Class extends Constructor,
|
|
113
|
+
toBeInstanceOf<Class extends Constructor, Match extends Matcher>(constructor: Class, matcher: Match): Matcher<InferMatcher<InstanceType<Class>, Match>>;
|
|
114
|
+
/**
|
|
115
|
+
* Expects the value to be an instance of the specified {@link Constructor},
|
|
116
|
+
* and further asserts it with an {@link AssertionFunction}.
|
|
117
|
+
*
|
|
118
|
+
* Negation: {@link NegativeMatchers.toBeInstanceOf `not.toInstanceOf(...)`}
|
|
119
|
+
*/
|
|
120
|
+
toBeInstanceOf<Class extends Constructor, Assert extends AssertionFunction<InstanceType<Class>>>(constructor: Class, assertion: Assert): Matcher<AssertedType<InstanceType<Class>, Assert>>;
|
|
95
121
|
/**
|
|
96
122
|
* Expects the value to be a `number` less than the specified expected value.
|
|
97
123
|
*
|
|
98
|
-
* Negation: {@link
|
|
124
|
+
* Negation: {@link Matcher.toBeGreaterThanOrEqual `toBeGreaterThanOrEqual(...)`}
|
|
99
125
|
*/
|
|
100
|
-
toBeLessThan(value: number):
|
|
126
|
+
toBeLessThan(value: number): Matcher<number>;
|
|
101
127
|
/**
|
|
102
128
|
* Expects the value to be a `bigint` less than the specified expected value.
|
|
103
129
|
*
|
|
104
|
-
* Negation: {@link
|
|
130
|
+
* Negation: {@link Matcher.toBeGreaterThanOrEqual `toBeGreaterThanOrEqual(...)`}
|
|
105
131
|
*/
|
|
106
|
-
toBeLessThan(value: bigint):
|
|
132
|
+
toBeLessThan(value: bigint): Matcher<bigint>;
|
|
107
133
|
/**
|
|
108
134
|
* Expects the value to be a `number` less than or equal to* the specified
|
|
109
135
|
* expected value.
|
|
110
136
|
*
|
|
111
|
-
* Negation: {@link
|
|
137
|
+
* Negation: {@link Matcher.toBeGreaterThan `toBeGreaterThan(...)`}
|
|
112
138
|
*/
|
|
113
|
-
toBeLessThanOrEqual(value: number):
|
|
139
|
+
toBeLessThanOrEqual(value: number): Matcher<number>;
|
|
114
140
|
/**
|
|
115
141
|
* Expects the value to be a `bigint` less than or equal to the specified
|
|
116
142
|
* expected value.
|
|
117
143
|
*
|
|
118
|
-
* Negation: {@link
|
|
144
|
+
* Negation: {@link Matcher.toBeGreaterThan `toBeGreaterThan(...)`}
|
|
119
145
|
*/
|
|
120
|
-
toBeLessThanOrEqual(value: bigint):
|
|
146
|
+
toBeLessThanOrEqual(value: bigint): Matcher<bigint>;
|
|
121
147
|
/**
|
|
122
148
|
* Expects the value to be `NaN`.
|
|
123
149
|
*
|
|
124
150
|
* Negation: {@link NegativeMatchers.toBeNaN `not.toBeNaN()`}
|
|
125
151
|
*/
|
|
126
|
-
toBeNaN():
|
|
152
|
+
toBeNaN(): Matcher<number>;
|
|
127
153
|
/** Expects the value to strictly equal `null`. */
|
|
128
|
-
toBeNull():
|
|
154
|
+
toBeNull(): Matcher<null>;
|
|
129
155
|
/** Expects the value to strictly equal `true`. */
|
|
130
|
-
toBeTrue():
|
|
156
|
+
toBeTrue(): Matcher<true>;
|
|
131
157
|
/**
|
|
132
158
|
* Expects the value to be _falsy_ (non-zero, non-empty string, ...).
|
|
133
159
|
*
|
|
134
|
-
* Negation: {@link
|
|
160
|
+
* Negation: {@link Matcher.toBeFalsy `toBeFalsy()`}
|
|
135
161
|
*/
|
|
136
|
-
toBeTruthy():
|
|
162
|
+
toBeTruthy(): Matcher<T>;
|
|
137
163
|
/** Expects the value to strictly equal `undefined`. */
|
|
138
|
-
toBeUndefined():
|
|
164
|
+
toBeUndefined(): Matcher<undefined>;
|
|
139
165
|
/**
|
|
140
166
|
* Expects the value to be a `number` within the specified range where the
|
|
141
167
|
* minimum and maximum values are inclusive.
|
|
142
168
|
*
|
|
143
169
|
* Negation: {@link NegativeMatchers.toBeWithinRange `not.toBeWithinRange(...)`}
|
|
144
170
|
*/
|
|
145
|
-
toBeWithinRange(min: number, max: number):
|
|
171
|
+
toBeWithinRange(min: number, max: number): Matcher<number>;
|
|
146
172
|
/**
|
|
147
173
|
* Expects the value to be a `bigint` within the specified range where the
|
|
148
174
|
* minimum and maximum values are inclusive.
|
|
149
175
|
*
|
|
150
176
|
* Negation: {@link NegativeMatchers.toBeWithinRange `not.toBeWithinRange(...)`}
|
|
151
177
|
*/
|
|
152
|
-
toBeWithinRange(min: bigint, max: bigint):
|
|
178
|
+
toBeWithinRange(min: bigint, max: bigint): Matcher<bigint>;
|
|
153
179
|
/**
|
|
154
180
|
* Expects the value to be _deep equal to_ the specified expected one.
|
|
155
181
|
*
|
|
156
182
|
* Negation: {@link NegativeMatchers.toEqual `not.toEqual(...)`}
|
|
157
183
|
*/
|
|
158
|
-
toEqual<Type>(expected: Type):
|
|
184
|
+
toEqual<Type>(expected: Type): Matcher<InferToEqual<Type>>;
|
|
159
185
|
/**
|
|
160
186
|
* Expects the value to have a `number` _property_ `length` with the specified
|
|
161
187
|
* expected value.
|
|
162
188
|
*
|
|
163
189
|
* Negation: {@link NegativeMatchers.toHaveLength `not.toHaveLength(...)`}
|
|
164
190
|
*/
|
|
165
|
-
toHaveLength(length: number):
|
|
191
|
+
toHaveLength(length: number): Matcher<T & {
|
|
166
192
|
length: number;
|
|
167
193
|
}>;
|
|
168
194
|
/**
|
|
169
|
-
* Expects the value to have the specified _property_
|
|
170
|
-
*
|
|
195
|
+
* Expects the value to have the specified _property_.
|
|
196
|
+
*
|
|
197
|
+
* Negation: {@link NegativeExpectations.toHaveProperty `not.toHaveProperty(...)`}
|
|
198
|
+
*/
|
|
199
|
+
toHaveProperty<Prop extends string | number | symbol>(property: Prop): Matcher<T & {
|
|
200
|
+
[keyt in Prop]: unknown;
|
|
201
|
+
}>;
|
|
202
|
+
/**
|
|
203
|
+
* Expects the value to have the specified _property_ and validates its value
|
|
204
|
+
* with a {@link Matcher}.
|
|
205
|
+
*
|
|
206
|
+
* Negation: {@link NegativeExpectations.toHaveProperty `not.toHaveProperty(...)`}
|
|
207
|
+
*/
|
|
208
|
+
toHaveProperty<Prop extends string | number | symbol, Match extends Matcher>(property: Prop, matcher: Match): Matcher<T & {
|
|
209
|
+
[keyt in Prop]: InferMatcher<unknown, Match>;
|
|
210
|
+
}>;
|
|
211
|
+
/**
|
|
212
|
+
* Expects the value to have the specified _property_ and further asserts
|
|
213
|
+
* its value with an {@link AssertionFunction}.
|
|
171
214
|
*
|
|
172
215
|
* Negation: {@link NegativeMatchers.toHaveProperty `not.toHaveProperty(...)`}
|
|
173
216
|
*/
|
|
174
|
-
toHaveProperty<Prop extends string | number | symbol, Assert extends AssertionFunction>(property: Prop, assertion
|
|
217
|
+
toHaveProperty<Prop extends string | number | symbol, Assert extends AssertionFunction>(property: Prop, assertion: Assert): Matcher<T & {
|
|
175
218
|
[keyt in Prop]: AssertedType<unknown, Assert>;
|
|
176
219
|
}>;
|
|
177
220
|
/**
|
|
@@ -180,7 +223,7 @@ export declare class Matchers<T = unknown> {
|
|
|
180
223
|
*
|
|
181
224
|
* Negation: {@link NegativeMatchers.toHaveSize `not.toHaveSize(...)`}
|
|
182
225
|
*/
|
|
183
|
-
toHaveSize(size: number):
|
|
226
|
+
toHaveSize(size: number): Matcher<T & {
|
|
184
227
|
size: number;
|
|
185
228
|
}>;
|
|
186
229
|
/**
|
|
@@ -191,139 +234,139 @@ export declare class Matchers<T = unknown> {
|
|
|
191
234
|
*
|
|
192
235
|
* Negation: {@link NegativeMatchers.toInclude `not.toInclude(...)`}
|
|
193
236
|
*/
|
|
194
|
-
toInclude<P extends Record<string, any>>(properties: P):
|
|
237
|
+
toInclude<P extends Record<string, any>>(properties: P): Matcher<T>;
|
|
195
238
|
/**
|
|
196
239
|
* Expect the value to include _all_ mappings from the specified {@link Map}.
|
|
197
240
|
*
|
|
198
241
|
* Negation: {@link NegativeMatchers.toInclude `not.toInclude(...)`}
|
|
199
242
|
*/
|
|
200
|
-
toInclude(mappings: Map<any, any>):
|
|
243
|
+
toInclude(mappings: Map<any, any>): Matcher<T>;
|
|
201
244
|
/**
|
|
202
245
|
* Expect the value to be an {@link Iterable} object includind _all_ values
|
|
203
246
|
* from the specified {@link Set}, in any order.
|
|
204
247
|
*
|
|
205
248
|
* Negation: {@link NegativeMatchers.toInclude `not.toInclude(...)`}
|
|
206
249
|
*/
|
|
207
|
-
toInclude(entries: Set<any>):
|
|
250
|
+
toInclude(entries: Set<any>): Matcher<T>;
|
|
208
251
|
/**
|
|
209
252
|
* Expect the value to be an {@link Iterable} object includind _all_ values
|
|
210
253
|
* from the specified _array_, in any order.
|
|
211
254
|
*
|
|
212
255
|
* Negation: {@link NegativeMatchers.toInclude `not.toInclude(...)`}
|
|
213
256
|
*/
|
|
214
|
-
toInclude(values: any[]):
|
|
257
|
+
toInclude(values: any[]): Matcher<T>;
|
|
215
258
|
/**
|
|
216
259
|
* Expects the value to be a `string` _matching_ the specified sub-`string`
|
|
217
260
|
* or {@link RegExp}.
|
|
218
261
|
*
|
|
219
262
|
* Negation: {@link NegativeMatchers.toMatch `not.toMatch(...)`}
|
|
220
263
|
*/
|
|
221
|
-
toMatch<
|
|
264
|
+
toMatch<Match extends string | RegExp>(matcher: Match): Matcher<string>;
|
|
222
265
|
/**
|
|
223
266
|
* Expect the value to be an {@link Iterable} object includind _all_ values
|
|
224
267
|
* (and only those values) from the specified _array_, in any order.
|
|
225
268
|
*/
|
|
226
|
-
toMatchContents(contents: any[]):
|
|
269
|
+
toMatchContents(contents: any[]): Matcher<T>;
|
|
227
270
|
/**
|
|
228
271
|
* Expect the value to be an {@link Iterable} object includind _all_ values
|
|
229
272
|
* (and only those values) from the specified {@link Set}, in any order.
|
|
230
273
|
*/
|
|
231
|
-
toMatchContents(contents: Set<any>):
|
|
274
|
+
toMatchContents(contents: Set<any>): Matcher<T>;
|
|
232
275
|
/**
|
|
233
276
|
* Expects the value to be _strictly equal to_ the specified expected one.
|
|
234
277
|
*
|
|
235
278
|
* Negation: {@link NegativeMatchers.toStrictlyEqual `not.toStrictlyEqual(...)`}
|
|
236
279
|
*/
|
|
237
|
-
toStrictlyEqual<Type>(expected: Type):
|
|
280
|
+
toStrictlyEqual<Type>(expected: Type): Matcher<Type>;
|
|
238
281
|
}
|
|
239
282
|
export declare class NegativeMatchers<T = unknown> {
|
|
240
283
|
private readonly _instance;
|
|
241
284
|
private readonly _matchers;
|
|
242
|
-
constructor(_instance:
|
|
285
|
+
constructor(_instance: Matcher<T>, _matchers: PositiveMatcherFunction[]);
|
|
243
286
|
private _push;
|
|
244
287
|
/**
|
|
245
288
|
* Expects the value _**NOT**_ to be of the specified _extended_
|
|
246
289
|
* {@link TypeName type}.
|
|
247
290
|
*
|
|
248
|
-
* Negates: {@link
|
|
291
|
+
* Negates: {@link Matcher.toBeA `toBeA(...)`}
|
|
249
292
|
*/
|
|
250
|
-
toBeA(type: TypeName):
|
|
293
|
+
toBeA(type: TypeName): Matcher<T>;
|
|
251
294
|
/**
|
|
252
295
|
* Expects the value to be a `number` _**OUTSIDE**_ of the given +/- _delta_
|
|
253
296
|
* range of the specified expected value.
|
|
254
297
|
*
|
|
255
|
-
* Negates: {@link
|
|
298
|
+
* Negates: {@link Matcher.toBeCloseTo `toBeCloseTo(...)`}
|
|
256
299
|
*/
|
|
257
|
-
toBeCloseTo(value: number, delta: number):
|
|
300
|
+
toBeCloseTo(value: number, delta: number): Matcher<number>;
|
|
258
301
|
/**
|
|
259
302
|
* Expects the value to be a `bigint` _**OUTSIDE**_ of the given +/- _delta_
|
|
260
303
|
* range of the specified expected value.
|
|
261
304
|
*
|
|
262
|
-
* Negates: {@link
|
|
305
|
+
* Negates: {@link Matcher.toBeCloseTo `toBeCloseTo(...)`}
|
|
263
306
|
*/
|
|
264
|
-
toBeCloseTo(value: bigint, delta: bigint):
|
|
307
|
+
toBeCloseTo(value: bigint, delta: bigint): Matcher<bigint>;
|
|
265
308
|
/**
|
|
266
309
|
* Expects the value to be either `null` or `undefined`.
|
|
267
310
|
*
|
|
268
|
-
* Negates: {@link
|
|
311
|
+
* Negates: {@link Matcher.toBeDefined `toBeDefined()`}
|
|
269
312
|
*/
|
|
270
|
-
toBeDefined():
|
|
313
|
+
toBeDefined(): Matcher<null | undefined>;
|
|
271
314
|
/**
|
|
272
315
|
* Expects the value _**NOT**_ to be an instance of the specified
|
|
273
316
|
* {@link Constructor}.
|
|
274
317
|
*
|
|
275
|
-
* Negates: {@link
|
|
318
|
+
* Negates: {@link Matcher.toBeInstanceOf `toBeInstanceOf(...)`}
|
|
276
319
|
*/
|
|
277
|
-
toBeInstanceOf(constructor: Constructor):
|
|
320
|
+
toBeInstanceOf(constructor: Constructor): Matcher<T>;
|
|
278
321
|
/**
|
|
279
322
|
* Expects the value _**NOT**_ to be `NaN`.
|
|
280
323
|
*
|
|
281
|
-
* Negates: {@link
|
|
324
|
+
* Negates: {@link Matcher.toBeNaN `toBeNaN()`}
|
|
282
325
|
*/
|
|
283
|
-
toBeNaN():
|
|
326
|
+
toBeNaN(): Matcher<number>;
|
|
284
327
|
/**
|
|
285
328
|
* Expects the value to be a `number` _**OUTSIDE**_ of the specified range
|
|
286
329
|
* where minimum and maximum values are inclusive.
|
|
287
330
|
*
|
|
288
|
-
* Negates: {@link
|
|
331
|
+
* Negates: {@link Matcher.toBeWithinRange `toBeWithinRange(...)`}
|
|
289
332
|
*/
|
|
290
|
-
toBeWithinRange(min: number, max: number):
|
|
333
|
+
toBeWithinRange(min: number, max: number): Matcher<number>;
|
|
291
334
|
/**
|
|
292
335
|
* Expects the value to be a `bigint` _**OUTSIDE**_ of the specified range
|
|
293
336
|
* where minimum and maximum values are inclusive.
|
|
294
337
|
*
|
|
295
|
-
* Negates: {@link
|
|
338
|
+
* Negates: {@link Matcher.toBeWithinRange `toBeWithinRange(...)`}
|
|
296
339
|
*/
|
|
297
|
-
toBeWithinRange(min: bigint, max: bigint):
|
|
340
|
+
toBeWithinRange(min: bigint, max: bigint): Matcher<bigint>;
|
|
298
341
|
/**
|
|
299
342
|
* Expects the value _**NOT**_ to be _deep equal to_ the specified expected
|
|
300
343
|
* one.
|
|
301
344
|
*
|
|
302
|
-
* Negates: {@link
|
|
345
|
+
* Negates: {@link Matcher.toEqual `toEqual(...)`}
|
|
303
346
|
*/
|
|
304
|
-
toEqual(expected: any):
|
|
347
|
+
toEqual(expected: any): Matcher<T>;
|
|
305
348
|
/**
|
|
306
349
|
* Expects the value to have a `number` _property_ `length` _different_ from
|
|
307
350
|
* the specified expected value.
|
|
308
351
|
*
|
|
309
|
-
* Negates: {@link
|
|
352
|
+
* Negates: {@link Matcher.toHaveLength `toHaveLength(...)`}
|
|
310
353
|
*/
|
|
311
|
-
toHaveLength(length: number):
|
|
354
|
+
toHaveLength(length: number): Matcher<T & {
|
|
312
355
|
length: number;
|
|
313
356
|
}>;
|
|
314
357
|
/**
|
|
315
358
|
* Expects the value _**NOT**_ to have the specified _property_.
|
|
316
359
|
*
|
|
317
|
-
* Negates: {@link
|
|
360
|
+
* Negates: {@link Matcher.toHaveProperty `toHaveProperty(...)`}
|
|
318
361
|
*/
|
|
319
|
-
toHaveProperty(property: string | number | symbol):
|
|
362
|
+
toHaveProperty(property: string | number | symbol): Matcher<T>;
|
|
320
363
|
/**
|
|
321
364
|
* Expects the value to have a `number` _property_ `size` _different_ from
|
|
322
365
|
* the specified expected value.
|
|
323
366
|
*
|
|
324
|
-
* Negates: {@link
|
|
367
|
+
* Negates: {@link Matcher.toHaveSize `toHaveSize(...)`}
|
|
325
368
|
*/
|
|
326
|
-
toHaveSize(size: number):
|
|
369
|
+
toHaveSize(size: number): Matcher<T & {
|
|
327
370
|
size: number;
|
|
328
371
|
}>;
|
|
329
372
|
/**
|
|
@@ -333,43 +376,43 @@ export declare class NegativeMatchers<T = unknown> {
|
|
|
333
376
|
* If the object being expected is a {@link Map}, the properties specified
|
|
334
377
|
* here will be treated as _mappings_ for said {@link Map}.
|
|
335
378
|
*
|
|
336
|
-
* Negates: {@link
|
|
379
|
+
* Negates: {@link Matcher.toInclude `toInclude(...)`}
|
|
337
380
|
*/
|
|
338
|
-
toInclude<P extends Record<string, any>>(properties: P):
|
|
381
|
+
toInclude<P extends Record<string, any>>(properties: P): Matcher<T>;
|
|
339
382
|
/**
|
|
340
383
|
* Expect the value to include _none_ of the mappings from the specified
|
|
341
384
|
* {@link Map}.
|
|
342
385
|
*
|
|
343
|
-
* Negates: {@link
|
|
386
|
+
* Negates: {@link Matcher.toInclude `toInclude(...)`}
|
|
344
387
|
*/
|
|
345
|
-
toInclude(mappings: Map<any, any>):
|
|
388
|
+
toInclude(mappings: Map<any, any>): Matcher<T>;
|
|
346
389
|
/**
|
|
347
390
|
* Expect the value to be an {@link Iterable} object includind _none_ of the
|
|
348
391
|
* values from the specified {@link Set}.
|
|
349
392
|
*
|
|
350
|
-
* Negates: {@link
|
|
393
|
+
* Negates: {@link Matcher.toInclude `toInclude(...)`}
|
|
351
394
|
*/
|
|
352
|
-
toInclude(entries: Set<any>):
|
|
395
|
+
toInclude(entries: Set<any>): Matcher<T>;
|
|
353
396
|
/**
|
|
354
397
|
* Expect the value to be an {@link Iterable} object includind _none_ of the
|
|
355
398
|
* values from the specified _array_.
|
|
356
399
|
*
|
|
357
|
-
* Negates: {@link
|
|
400
|
+
* Negates: {@link Matcher.toInclude `toInclude(...)`}
|
|
358
401
|
*/
|
|
359
|
-
toInclude(values: any[]):
|
|
402
|
+
toInclude(values: any[]): Matcher<T>;
|
|
360
403
|
/**
|
|
361
404
|
* Expects the value to be a `string` _**NOT MATCHING**_ the specified
|
|
362
405
|
* sub-`string` or {@link RegExp}.
|
|
363
406
|
*
|
|
364
|
-
* Negates: {@link
|
|
407
|
+
* Negates: {@link Matcher.toMatch `toMatch(...)`}
|
|
365
408
|
*/
|
|
366
|
-
toMatch(matcher: string | RegExp):
|
|
409
|
+
toMatch(matcher: string | RegExp): Matcher<string>;
|
|
367
410
|
/**
|
|
368
411
|
* Expects the value _**NOT**_ to be _strictly equal to_ the specified
|
|
369
412
|
* expected one.
|
|
370
413
|
*
|
|
371
|
-
* Negates: {@link
|
|
414
|
+
* Negates: {@link Matcher.toStrictlyEqual `toStrictlyEqual(...)`}
|
|
372
415
|
*/
|
|
373
|
-
toStrictlyEqual(expected: any):
|
|
416
|
+
toStrictlyEqual(expected: any): Matcher<T>;
|
|
374
417
|
}
|
|
375
418
|
export {};
|