eslint-config-typed 4.0.2 → 4.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/package.json +3 -2
- package/vitest-globals.d.mts +1616 -0
|
@@ -0,0 +1,1616 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-restricted-types */
|
|
3
|
+
/* eslint-disable @typescript-eslint/consistent-type-imports */
|
|
4
|
+
|
|
5
|
+
// Copied from https://github.com/vitest-dev/vitest/blob/v4.0.14/packages/vitest/globals.d.ts and replaced `assert`
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
const assert: OverriddenAssert;
|
|
9
|
+
|
|
10
|
+
const suite: (typeof import('vitest'))['suite'];
|
|
11
|
+
|
|
12
|
+
const test: (typeof import('vitest'))['test'];
|
|
13
|
+
|
|
14
|
+
const chai: (typeof import('vitest'))['chai'];
|
|
15
|
+
|
|
16
|
+
const describe: (typeof import('vitest'))['describe'];
|
|
17
|
+
|
|
18
|
+
const it: (typeof import('vitest'))['it'];
|
|
19
|
+
|
|
20
|
+
const expectTypeOf: (typeof import('vitest'))['expectTypeOf'];
|
|
21
|
+
|
|
22
|
+
const assertType: (typeof import('vitest'))['assertType'];
|
|
23
|
+
|
|
24
|
+
const expect: (typeof import('vitest'))['expect'];
|
|
25
|
+
|
|
26
|
+
const vitest: (typeof import('vitest'))['vitest'];
|
|
27
|
+
|
|
28
|
+
const vi: (typeof import('vitest'))['vitest'];
|
|
29
|
+
|
|
30
|
+
const beforeAll: (typeof import('vitest'))['beforeAll'];
|
|
31
|
+
|
|
32
|
+
const afterAll: (typeof import('vitest'))['afterAll'];
|
|
33
|
+
|
|
34
|
+
const beforeEach: (typeof import('vitest'))['beforeEach'];
|
|
35
|
+
|
|
36
|
+
const afterEach: (typeof import('vitest'))['afterEach'];
|
|
37
|
+
|
|
38
|
+
const onTestFailed: (typeof import('vitest'))['onTestFailed'];
|
|
39
|
+
|
|
40
|
+
const onTestFinished: (typeof import('vitest'))['onTestFinished'];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// eslint-disable-next-line unicorn/require-module-specifiers
|
|
44
|
+
export {};
|
|
45
|
+
|
|
46
|
+
type Constructor<T> = Chai.Constructor<T>;
|
|
47
|
+
|
|
48
|
+
type Operator = Chai.Operator;
|
|
49
|
+
|
|
50
|
+
type OperatorComparable = Chai.OperatorComparable;
|
|
51
|
+
|
|
52
|
+
type OverriddenAssert = Readonly<{
|
|
53
|
+
/**
|
|
54
|
+
* Asserts that value is true.
|
|
55
|
+
*
|
|
56
|
+
* @param value Actual value.
|
|
57
|
+
*/
|
|
58
|
+
isTrue: (value: boolean) => asserts value;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Asserts that value is false.
|
|
62
|
+
*
|
|
63
|
+
* @param value Actual value.
|
|
64
|
+
*/
|
|
65
|
+
isFalse: (value: boolean) => asserts value is false;
|
|
66
|
+
|
|
67
|
+
// ModifiedChai.Assert
|
|
68
|
+
//
|
|
69
|
+
// - Removed optional `message` arg
|
|
70
|
+
// - Convert arg types to be readonly
|
|
71
|
+
// - Replace `Object` with `object`
|
|
72
|
+
// - Removed the call signature
|
|
73
|
+
// - Removed deepEqual, equal, notEqual, ok, notOk, isOk, isNotOk, isTrue, isFalse
|
|
74
|
+
// - deepEqual // Removed in favor of assert.deepStrictEqual
|
|
75
|
+
// - equal // Removed in favor of assert.strictEqual
|
|
76
|
+
// - notEqual // Removed in favor of assert.notStrictEqual
|
|
77
|
+
// - ok // Removed in favor of assert.isTrue
|
|
78
|
+
// - notOk // Removed in favor of assert.isFalse
|
|
79
|
+
// - isOk // Removed in favor of assert.isTrue
|
|
80
|
+
// - isNotOk // Removed in favor of assert.isFalse
|
|
81
|
+
// - isTrue // Overridden with OverriddenAssert
|
|
82
|
+
// - isFalse // Overridden with OverriddenAssert
|
|
83
|
+
|
|
84
|
+
// /**
|
|
85
|
+
// * @param expression Expression to test for truthiness.
|
|
86
|
+
// */
|
|
87
|
+
// (expression: unknown): asserts expression;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Throws a failure.
|
|
91
|
+
*
|
|
92
|
+
* @remarks Node.js assert module-compatible.
|
|
93
|
+
*/
|
|
94
|
+
fail: (() => never) &
|
|
95
|
+
(<T>(actual: T, expected: T, operator?: Operator) => never);
|
|
96
|
+
|
|
97
|
+
// /**
|
|
98
|
+
// * Asserts that object is truthy.
|
|
99
|
+
// *
|
|
100
|
+
// * @param object Object to test.
|
|
101
|
+
// */
|
|
102
|
+
// isOk: (value: unknown) => asserts value;
|
|
103
|
+
|
|
104
|
+
// /**
|
|
105
|
+
// * Asserts that object is truthy.
|
|
106
|
+
// *
|
|
107
|
+
// * @param object Object to test.
|
|
108
|
+
// */
|
|
109
|
+
// ok: (value: unknown) => asserts value;
|
|
110
|
+
|
|
111
|
+
// /**
|
|
112
|
+
// * Asserts that object is falsy.
|
|
113
|
+
// *
|
|
114
|
+
// * T Type of object.
|
|
115
|
+
// * @param object Object to test.
|
|
116
|
+
// */
|
|
117
|
+
// isNotOk: <T>(value: T) => void;
|
|
118
|
+
|
|
119
|
+
// /**
|
|
120
|
+
// * Asserts that object is falsy.
|
|
121
|
+
// *
|
|
122
|
+
// * T Type of object.
|
|
123
|
+
// * @param object Object to test.
|
|
124
|
+
// */
|
|
125
|
+
// notOk: <T>(value: T) => void;
|
|
126
|
+
|
|
127
|
+
// /**
|
|
128
|
+
// * Asserts non-strict equality (==) of actual and expected.
|
|
129
|
+
// *
|
|
130
|
+
// * T Type of the objects.
|
|
131
|
+
// * @param actual Actual value.
|
|
132
|
+
// * @param expected Potential expected value.
|
|
133
|
+
// */
|
|
134
|
+
// equal: <T>(actual: T, expected: T) => void;
|
|
135
|
+
|
|
136
|
+
// /**
|
|
137
|
+
// * Asserts non-strict inequality (!=) of actual and expected.
|
|
138
|
+
// *
|
|
139
|
+
// * T Type of the objects.
|
|
140
|
+
// * @param actual Actual value.
|
|
141
|
+
// * @param expected Potential expected value.
|
|
142
|
+
// */
|
|
143
|
+
// notEqual: <T>(actual: T, expected: T) => void;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Asserts strict equality (===) of actual and expected.
|
|
147
|
+
*
|
|
148
|
+
* T Type of the objects.
|
|
149
|
+
* @param actual Actual value.
|
|
150
|
+
* @param expected Potential expected value.
|
|
151
|
+
*/
|
|
152
|
+
strictEqual: <T>(actual: T, expected: T) => void;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Asserts strict inequality (!==) of actual and expected.
|
|
156
|
+
*
|
|
157
|
+
* T Type of the objects.
|
|
158
|
+
* @param actual Actual value.
|
|
159
|
+
* @param expected Potential expected value.
|
|
160
|
+
*/
|
|
161
|
+
notStrictEqual: <T>(actual: T, expected: T) => void;
|
|
162
|
+
|
|
163
|
+
// /**
|
|
164
|
+
// * Asserts that actual is deeply equal to expected.
|
|
165
|
+
// *
|
|
166
|
+
// * T Type of the objects.
|
|
167
|
+
// * @param actual Actual value.
|
|
168
|
+
// * @param expected Potential expected value.
|
|
169
|
+
// */
|
|
170
|
+
// deepEqual: <T>(actual: T, expected: T) => void;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Asserts that actual is not deeply equal to expected.
|
|
174
|
+
*
|
|
175
|
+
* T Type of the objects.
|
|
176
|
+
* @param actual Actual value.
|
|
177
|
+
* @param expected Potential expected value.
|
|
178
|
+
*/
|
|
179
|
+
notDeepEqual: <T>(actual: T, expected: T) => void;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Alias to deepEqual
|
|
183
|
+
*
|
|
184
|
+
* T Type of the objects.
|
|
185
|
+
* @param actual Actual value.
|
|
186
|
+
* @param expected Potential expected value.
|
|
187
|
+
*/
|
|
188
|
+
deepStrictEqual: <T>(actual: T, expected: T) => void;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Partially matches actual and expected.
|
|
192
|
+
*
|
|
193
|
+
* @param actual Actual value.
|
|
194
|
+
* @param expected Potential subset of the value.
|
|
195
|
+
*/
|
|
196
|
+
containSubset: (val: unknown, exp: unknown, msg?: string) => void;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Partially matches actual and expected.
|
|
200
|
+
*
|
|
201
|
+
* @param actual Actual value.
|
|
202
|
+
* @param expected Potential subset of the value.
|
|
203
|
+
*/
|
|
204
|
+
containsSubset: (val: unknown, exp: unknown, msg?: string) => void;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* No partial match between actual and expected exists.
|
|
208
|
+
*
|
|
209
|
+
* @param actual Actual value.
|
|
210
|
+
* @param expected Potential subset of the value.
|
|
211
|
+
*/
|
|
212
|
+
doesNotContainSubset: (val: unknown, exp: unknown, msg?: string) => void;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Asserts valueToCheck is strictly greater than (>) valueToBeAbove.
|
|
216
|
+
*
|
|
217
|
+
* @param valueToCheck Actual value.
|
|
218
|
+
* @param valueToBeAbove Minimum Potential expected value.
|
|
219
|
+
*/
|
|
220
|
+
isAbove: (valueToCheck: number, valueToBeAbove: number) => void;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast.
|
|
224
|
+
*
|
|
225
|
+
* @param valueToCheck Actual value.
|
|
226
|
+
* @param valueToBeAtLeast Minimum Potential expected value.
|
|
227
|
+
*/
|
|
228
|
+
isAtLeast: (valueToCheck: number, valueToBeAtLeast: number) => void;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Asserts valueToCheck is strictly less than (<) valueToBeBelow.
|
|
232
|
+
*
|
|
233
|
+
* @param valueToCheck Actual value.
|
|
234
|
+
* @param valueToBeBelow Minimum Potential expected value.
|
|
235
|
+
*/
|
|
236
|
+
isBelow: (valueToCheck: number, valueToBeBelow: number) => void;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost.
|
|
240
|
+
*
|
|
241
|
+
* @param valueToCheck Actual value.
|
|
242
|
+
* @param valueToBeAtMost Minimum Potential expected value.
|
|
243
|
+
*/
|
|
244
|
+
isAtMost: (valueToCheck: number, valueToBeAtMost: number) => void;
|
|
245
|
+
|
|
246
|
+
// /**
|
|
247
|
+
// * Asserts that value is true.
|
|
248
|
+
// *
|
|
249
|
+
// * @param value Actual value.
|
|
250
|
+
// */
|
|
251
|
+
// isTrue: (value: unknown) => asserts value is true;
|
|
252
|
+
|
|
253
|
+
// /**
|
|
254
|
+
// * Asserts that value is false.
|
|
255
|
+
// *
|
|
256
|
+
// * @param value Actual value.
|
|
257
|
+
// */
|
|
258
|
+
// isFalse: (value: unknown) => asserts value is false;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Asserts that value is not true.
|
|
262
|
+
*
|
|
263
|
+
* T Type of value.
|
|
264
|
+
* @param value Actual value.
|
|
265
|
+
*/
|
|
266
|
+
isNotTrue: <T>(value: T) => asserts value is Exclude<T, true>;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Asserts that value is not false.
|
|
270
|
+
*
|
|
271
|
+
* @param value Actual value.
|
|
272
|
+
*/
|
|
273
|
+
isNotFalse: <T>(value: T) => asserts value is Exclude<T, false>;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Asserts that value is null.
|
|
277
|
+
*
|
|
278
|
+
* @param value Actual value.
|
|
279
|
+
*/
|
|
280
|
+
isNull: (value: unknown) => asserts value is null;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Asserts that value is not null.
|
|
284
|
+
*
|
|
285
|
+
* T Type of value.
|
|
286
|
+
* @param value Actual value.
|
|
287
|
+
*/
|
|
288
|
+
isNotNull: <T>(value: T) => asserts value is Exclude<T, null>;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Asserts that value is NaN.
|
|
292
|
+
*
|
|
293
|
+
* T Type of value.
|
|
294
|
+
* @param value Actual value.
|
|
295
|
+
*/
|
|
296
|
+
isNaN: <T>(value: T) => void;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Asserts that value is not NaN.
|
|
300
|
+
*
|
|
301
|
+
* T Type of value.
|
|
302
|
+
* @param value Actual value.
|
|
303
|
+
*/
|
|
304
|
+
isNotNaN: <T>(value: T) => void;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Asserts that the target is neither null nor undefined.
|
|
308
|
+
*
|
|
309
|
+
* T Type of value.
|
|
310
|
+
* @param value Actual value.
|
|
311
|
+
*/
|
|
312
|
+
exists: <T>(value: T) => asserts value is NonNullable<T>;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Asserts that the target is either null or undefined.
|
|
316
|
+
*
|
|
317
|
+
* @param value Actual value.
|
|
318
|
+
*/
|
|
319
|
+
notExists: (value: unknown) => asserts value is null | undefined;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Asserts that value is undefined.
|
|
323
|
+
*
|
|
324
|
+
* @param value Actual value.
|
|
325
|
+
*/
|
|
326
|
+
isUndefined: (value: unknown) => asserts value is undefined;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Asserts that value is not undefined.
|
|
330
|
+
*
|
|
331
|
+
* T Type of value.
|
|
332
|
+
* @param value Actual value.
|
|
333
|
+
*/
|
|
334
|
+
isDefined: <T>(value: T) => asserts value is Exclude<T, undefined>;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Asserts that value is a function.
|
|
338
|
+
*
|
|
339
|
+
* T Type of value.
|
|
340
|
+
* @param value Actual value.
|
|
341
|
+
*/
|
|
342
|
+
isFunction: <T>(value: T) => void;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Asserts that value is not a function.
|
|
346
|
+
*
|
|
347
|
+
* T Type of value.
|
|
348
|
+
* @param value Actual value.
|
|
349
|
+
*/
|
|
350
|
+
isNotFunction: <T>(value: T) => void;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Asserts that value is an object of type 'Object'
|
|
354
|
+
* (as revealed by Object.prototype.toString).
|
|
355
|
+
*
|
|
356
|
+
* T Type of value.
|
|
357
|
+
* @param value Actual value.
|
|
358
|
+
* @remarks The assertion does not match subclassed objects.
|
|
359
|
+
*/
|
|
360
|
+
isObject: <T>(value: T) => void;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Asserts that value is not an object of type 'Object'
|
|
364
|
+
* (as revealed by Object.prototype.toString).
|
|
365
|
+
*
|
|
366
|
+
* T Type of value.
|
|
367
|
+
* @param value Actual value.
|
|
368
|
+
*/
|
|
369
|
+
isNotObject: <T>(value: T) => void;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Asserts that value is an array.
|
|
373
|
+
*
|
|
374
|
+
* T Type of value.
|
|
375
|
+
* @param value Actual value.
|
|
376
|
+
*/
|
|
377
|
+
isArray: <T>(value: T) => void;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Asserts that value is not an array.
|
|
381
|
+
*
|
|
382
|
+
* T Type of value.
|
|
383
|
+
* @param value Actual value.
|
|
384
|
+
*/
|
|
385
|
+
isNotArray: <T>(value: T) => void;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Asserts that value is a string.
|
|
389
|
+
*
|
|
390
|
+
* T Type of value.
|
|
391
|
+
* @param value Actual value.
|
|
392
|
+
*/
|
|
393
|
+
isString: <T>(value: T) => void;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Asserts that value is not a string.
|
|
397
|
+
*
|
|
398
|
+
* T Type of value.
|
|
399
|
+
* @param value Actual value.
|
|
400
|
+
*/
|
|
401
|
+
isNotString: <T>(value: T) => void;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Asserts that value is a number.
|
|
405
|
+
*
|
|
406
|
+
* T Type of value.
|
|
407
|
+
* @param value Actual value.
|
|
408
|
+
*/
|
|
409
|
+
isNumber: <T>(value: T) => void;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Asserts that value is not a number.
|
|
413
|
+
*
|
|
414
|
+
* T Type of value.
|
|
415
|
+
* @param value Actual value.
|
|
416
|
+
*/
|
|
417
|
+
isNotNumber: <T>(value: T) => void;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Asserts that value is a finite number.
|
|
421
|
+
* Unlike `.isNumber`, this will fail for `NaN` and `Infinity`.
|
|
422
|
+
*
|
|
423
|
+
* T Type of value
|
|
424
|
+
* @param value Actual value
|
|
425
|
+
*/
|
|
426
|
+
isFinite: <T>(value: T) => void;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Asserts that value is a boolean.
|
|
430
|
+
*
|
|
431
|
+
* T Type of value.
|
|
432
|
+
* @param value Actual value.
|
|
433
|
+
*/
|
|
434
|
+
isBoolean: <T>(value: T) => void;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Asserts that value is not a boolean.
|
|
438
|
+
*
|
|
439
|
+
* T Type of value.
|
|
440
|
+
* @param value Actual value.
|
|
441
|
+
*/
|
|
442
|
+
isNotBoolean: <T>(value: T) => void;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Asserts that value's type is name, as determined by Object.prototype.toString.
|
|
446
|
+
*
|
|
447
|
+
* T Type of value.
|
|
448
|
+
* @param value Actual value.
|
|
449
|
+
* @param name Potential expected type name of value.
|
|
450
|
+
*/
|
|
451
|
+
typeOf: <T>(value: T, name: string) => void;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Asserts that value's type is not name, as determined by Object.prototype.toString.
|
|
455
|
+
*
|
|
456
|
+
* T Type of value.
|
|
457
|
+
* @param value Actual value.
|
|
458
|
+
* @param name Potential expected type name of value.
|
|
459
|
+
*/
|
|
460
|
+
notTypeOf: <T>(value: T, name: string) => void;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Asserts that value is an instance of constructor.
|
|
464
|
+
*
|
|
465
|
+
* T Expected type of value.
|
|
466
|
+
* @param value Actual value.
|
|
467
|
+
* @param ctor Potential expected constructor of value.
|
|
468
|
+
*/
|
|
469
|
+
instanceOf: <T>(value: unknown, ctor: Constructor<T>) => asserts value is T;
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Asserts that value is not an instance of constructor.
|
|
473
|
+
*
|
|
474
|
+
* T Type of value.
|
|
475
|
+
* U Type that value shouldn't be an instance of.
|
|
476
|
+
* @param value Actual value.
|
|
477
|
+
* @param ctor Potential expected constructor of value.
|
|
478
|
+
*/
|
|
479
|
+
notInstanceOf: <T, U>(
|
|
480
|
+
value: T,
|
|
481
|
+
ctor: Constructor<U>,
|
|
482
|
+
) => asserts value is Exclude<T, U>;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Asserts that haystack includes needle.
|
|
486
|
+
*
|
|
487
|
+
* @param haystack Container string.
|
|
488
|
+
* @param needle Potential substring of haystack.
|
|
489
|
+
*/
|
|
490
|
+
include: ((haystack: string, needle: string) => void) &
|
|
491
|
+
(<T>(
|
|
492
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
493
|
+
haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
|
|
494
|
+
needle: T,
|
|
495
|
+
) => void) &
|
|
496
|
+
(<T extends object>(haystack: WeakSet<T>, needle: T) => void) &
|
|
497
|
+
(<T>(haystack: T, needle: Partial<T>) => void);
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Asserts that haystack does not include needle.
|
|
501
|
+
*
|
|
502
|
+
* @param haystack Container string.
|
|
503
|
+
* @param needle Potential substring of haystack.
|
|
504
|
+
*/
|
|
505
|
+
notInclude: ((haystack: string, needle: string) => void) &
|
|
506
|
+
(<T>(
|
|
507
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
508
|
+
haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
|
|
509
|
+
needle: T,
|
|
510
|
+
) => void) &
|
|
511
|
+
(<T extends object>(haystack: WeakSet<T>, needle: T) => void) &
|
|
512
|
+
(<T>(haystack: T, needle: Partial<T>) => void);
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Asserts that haystack includes needle. Deep equality is used.
|
|
516
|
+
*
|
|
517
|
+
* @param haystack Container string.
|
|
518
|
+
* @param needle Potential substring of haystack.
|
|
519
|
+
*
|
|
520
|
+
* @deprecated Does not have any effect on string. Use {@link Assert#include} instead.
|
|
521
|
+
*/
|
|
522
|
+
deepInclude: ((haystack: string, needle: string) => void) &
|
|
523
|
+
(<T>(
|
|
524
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
525
|
+
haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
|
|
526
|
+
needle: T,
|
|
527
|
+
) => void) &
|
|
528
|
+
(<T>(
|
|
529
|
+
haystack: T,
|
|
530
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
531
|
+
needle: T extends WeakSet<any> ? never : Partial<T>,
|
|
532
|
+
) => void);
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Asserts that haystack does not include needle. Deep equality is used.
|
|
536
|
+
*
|
|
537
|
+
* @param haystack Container string.
|
|
538
|
+
* @param needle Potential substring of haystack.
|
|
539
|
+
*
|
|
540
|
+
* @deprecated Does not have any effect on string. Use {@link Assert#notInclude} instead.
|
|
541
|
+
*/
|
|
542
|
+
notDeepInclude: ((haystack: string, needle: string) => void) &
|
|
543
|
+
(<T>(
|
|
544
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
545
|
+
haystack: readonly T[] | ReadonlySet<T> | ReadonlyMap<any, T>,
|
|
546
|
+
needle: T,
|
|
547
|
+
) => void) &
|
|
548
|
+
(<T>(
|
|
549
|
+
haystack: T,
|
|
550
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
551
|
+
needle: T extends WeakSet<any> ? never : Partial<T>,
|
|
552
|
+
) => void);
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object.
|
|
556
|
+
*
|
|
557
|
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
|
558
|
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
|
|
559
|
+
* Can be used to assert the inclusion of a subset of properties in an object.
|
|
560
|
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
|
561
|
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
|
|
562
|
+
*
|
|
563
|
+
* @param haystack
|
|
564
|
+
* @param needle
|
|
565
|
+
*/
|
|
566
|
+
nestedInclude: (haystack: unknown, needle: unknown) => void;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object.
|
|
570
|
+
*
|
|
571
|
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
|
572
|
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
|
|
573
|
+
* Can be used to assert the inclusion of a subset of properties in an object.
|
|
574
|
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
|
575
|
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
|
|
576
|
+
*
|
|
577
|
+
* @param haystack
|
|
578
|
+
* @param needle
|
|
579
|
+
*/
|
|
580
|
+
notNestedInclude: (haystack: unknown, needle: unknown) => void;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality
|
|
584
|
+
*
|
|
585
|
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
|
586
|
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
|
|
587
|
+
* Can be used to assert the inclusion of a subset of properties in an object.
|
|
588
|
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
|
589
|
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
|
|
590
|
+
*
|
|
591
|
+
* @param haystack
|
|
592
|
+
* @param needle
|
|
593
|
+
*/
|
|
594
|
+
deepNestedInclude: (haystack: unknown, needle: unknown) => void;
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality.
|
|
598
|
+
*
|
|
599
|
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
|
600
|
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’.
|
|
601
|
+
* Can be used to assert the inclusion of a subset of properties in an object.
|
|
602
|
+
* Enables the use of dot- and bracket-notation for referencing nested properties.
|
|
603
|
+
* ‘[]’ and ‘.’ in property names can be escaped using double backslashes.
|
|
604
|
+
*
|
|
605
|
+
* @param haystack
|
|
606
|
+
* @param needle
|
|
607
|
+
*/
|
|
608
|
+
notDeepNestedInclude: (haystack: unknown, needle: unknown) => void;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties.
|
|
612
|
+
*
|
|
613
|
+
* @param haystack
|
|
614
|
+
* @param needle
|
|
615
|
+
*/
|
|
616
|
+
ownInclude: (haystack: unknown, needle: unknown) => void;
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties.
|
|
620
|
+
*
|
|
621
|
+
* @param haystack
|
|
622
|
+
* @param needle
|
|
623
|
+
*/
|
|
624
|
+
notOwnInclude: (haystack: unknown, needle: unknown) => void;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep
|
|
628
|
+
*
|
|
629
|
+
* @param haystack
|
|
630
|
+
* @param needle
|
|
631
|
+
*/
|
|
632
|
+
deepOwnInclude: (haystack: unknown, needle: unknown) => void;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality.
|
|
636
|
+
*
|
|
637
|
+
* @param haystack
|
|
638
|
+
* @param needle
|
|
639
|
+
*/
|
|
640
|
+
notDeepOwnInclude: (haystack: unknown, needle: unknown) => void;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Asserts that value matches the regular expression regexp.
|
|
644
|
+
*
|
|
645
|
+
* @param value Actual value.
|
|
646
|
+
* @param regexp Potential match of value.
|
|
647
|
+
*/
|
|
648
|
+
match: (value: string, regexp: RegExp) => void;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Asserts that value does not match the regular expression regexp.
|
|
652
|
+
*
|
|
653
|
+
* @param value Actual value.
|
|
654
|
+
* @param regexp Potential match of value.
|
|
655
|
+
*/
|
|
656
|
+
notMatch: (expected: unknown, regexp: RegExp) => void;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Asserts that object has a property named by property.
|
|
660
|
+
*
|
|
661
|
+
* T Type of object.
|
|
662
|
+
* @param object Container object.
|
|
663
|
+
* @param property Potential contained property of object.
|
|
664
|
+
*/
|
|
665
|
+
property: <T>(object: T, property: string /* keyof T */) => void;
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Asserts that object does not have a property named by property.
|
|
669
|
+
*
|
|
670
|
+
* T Type of object.
|
|
671
|
+
* @param object Container object.
|
|
672
|
+
* @param property Potential contained property of object.
|
|
673
|
+
*/
|
|
674
|
+
notProperty: <T>(object: T, property: string /* keyof T */) => void;
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Asserts that object has a property named by property, which can be a string
|
|
678
|
+
* using dot- and bracket-notation for deep reference.
|
|
679
|
+
*
|
|
680
|
+
* T Type of object.
|
|
681
|
+
* @param object Container object.
|
|
682
|
+
* @param property Potential contained property of object.
|
|
683
|
+
*/
|
|
684
|
+
deepProperty: <T>(object: T, property: string) => void;
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Asserts that object does not have a property named by property, which can be a
|
|
688
|
+
* string using dot- and bracket-notation for deep reference.
|
|
689
|
+
*
|
|
690
|
+
* T Type of object.
|
|
691
|
+
* @param object Container object.
|
|
692
|
+
* @param property Potential contained property of object.
|
|
693
|
+
*/
|
|
694
|
+
notDeepProperty: <T>(object: T, property: string) => void;
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Asserts that object has a property named by property with value given by value.
|
|
698
|
+
*
|
|
699
|
+
* T Type of object.
|
|
700
|
+
* V Type of value.
|
|
701
|
+
* @param object Container object.
|
|
702
|
+
* @param property Potential contained property of object.
|
|
703
|
+
* @param value Potential expected property value.
|
|
704
|
+
*/
|
|
705
|
+
propertyVal: <T, V>(
|
|
706
|
+
object: T,
|
|
707
|
+
property: string /* keyof T */,
|
|
708
|
+
value: V,
|
|
709
|
+
) => void;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Asserts that object has a property named by property with value given by value.
|
|
713
|
+
*
|
|
714
|
+
* T Type of object.
|
|
715
|
+
* V Type of value.
|
|
716
|
+
* @param object Container object.
|
|
717
|
+
* @param property Potential contained property of object.
|
|
718
|
+
* @param value Potential expected property value.
|
|
719
|
+
*/
|
|
720
|
+
notPropertyVal: <T, V>(
|
|
721
|
+
object: T,
|
|
722
|
+
property: string /* keyof T */,
|
|
723
|
+
value: V,
|
|
724
|
+
) => void;
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Asserts that object has a property named by property, which can be a string
|
|
728
|
+
* using dot- and bracket-notation for deep reference.
|
|
729
|
+
*
|
|
730
|
+
* T Type of object.
|
|
731
|
+
* V Type of value.
|
|
732
|
+
* @param object Container object.
|
|
733
|
+
* @param property Potential contained property of object.
|
|
734
|
+
* @param value Potential expected property value.
|
|
735
|
+
*/
|
|
736
|
+
deepPropertyVal: <T, V>(object: T, property: string, value: V) => void;
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Asserts that object does not have a property named by property, which can be a
|
|
740
|
+
* string using dot- and bracket-notation for deep reference.
|
|
741
|
+
*
|
|
742
|
+
* T Type of object.
|
|
743
|
+
* V Type of value.
|
|
744
|
+
* @param object Container object.
|
|
745
|
+
* @param property Potential contained property of object.
|
|
746
|
+
* @param value Potential expected property value.
|
|
747
|
+
*/
|
|
748
|
+
notDeepPropertyVal: <T, V>(object: T, property: string, value: V) => void;
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Asserts that object has a length property with the expected value.
|
|
752
|
+
*
|
|
753
|
+
* T Type of object.
|
|
754
|
+
* @param object Container object.
|
|
755
|
+
* @param length Potential expected length of object.
|
|
756
|
+
*/
|
|
757
|
+
lengthOf: <
|
|
758
|
+
T extends
|
|
759
|
+
| Readonly<{ length?: number | undefined }>
|
|
760
|
+
| Readonly<{ size?: number | undefined }>,
|
|
761
|
+
>(
|
|
762
|
+
object: T,
|
|
763
|
+
length: number,
|
|
764
|
+
) => void;
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Asserts that fn will throw an error.
|
|
768
|
+
*
|
|
769
|
+
* @param fn Function that may throw.
|
|
770
|
+
* @param errMsgMatcher Expected error message matcher.
|
|
771
|
+
* @param ignored Ignored parameter.
|
|
772
|
+
*/
|
|
773
|
+
throw: ((
|
|
774
|
+
fn: () => void,
|
|
775
|
+
errMsgMatcher?: RegExp | string,
|
|
776
|
+
ignored?: unknown,
|
|
777
|
+
) => void) &
|
|
778
|
+
((
|
|
779
|
+
fn: () => void,
|
|
780
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
781
|
+
errorLike?: ErrorConstructor | Error | null,
|
|
782
|
+
errMsgMatcher?: RegExp | string | null,
|
|
783
|
+
) => void);
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Asserts that fn will throw an error.
|
|
787
|
+
*
|
|
788
|
+
* @param fn Function that may throw.
|
|
789
|
+
* @param errMsgMatcher Expected error message matcher.
|
|
790
|
+
* @param ignored Ignored parameter.
|
|
791
|
+
*/
|
|
792
|
+
throws: ((
|
|
793
|
+
fn: () => void,
|
|
794
|
+
errMsgMatcher?: RegExp | string,
|
|
795
|
+
ignored?: unknown,
|
|
796
|
+
) => void) &
|
|
797
|
+
((
|
|
798
|
+
fn: () => void,
|
|
799
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
800
|
+
errorLike?: ErrorConstructor | Error | null,
|
|
801
|
+
errMsgMatcher?: RegExp | string | null,
|
|
802
|
+
) => void);
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Asserts that fn will throw an error.
|
|
806
|
+
*
|
|
807
|
+
* @param fn Function that may throw.
|
|
808
|
+
* @param errMsgMatcher Expected error message matcher.
|
|
809
|
+
* @param ignored Ignored parameter.
|
|
810
|
+
*/
|
|
811
|
+
Throw: ((
|
|
812
|
+
fn: () => void,
|
|
813
|
+
errMsgMatcher?: RegExp | string,
|
|
814
|
+
ignored?: unknown,
|
|
815
|
+
) => void) &
|
|
816
|
+
((
|
|
817
|
+
fn: () => void,
|
|
818
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
819
|
+
errorLike?: ErrorConstructor | Error | null,
|
|
820
|
+
errMsgMatcher?: RegExp | string | null,
|
|
821
|
+
) => void);
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Asserts that fn will not throw an error.
|
|
825
|
+
*
|
|
826
|
+
* @param fn Function that may throw.
|
|
827
|
+
* @param errMsgMatcher Expected error message matcher.
|
|
828
|
+
* @param ignored Ignored parameter.
|
|
829
|
+
*/
|
|
830
|
+
doesNotThrow: ((
|
|
831
|
+
fn: () => void,
|
|
832
|
+
errMsgMatcher?: RegExp | string,
|
|
833
|
+
ignored?: unknown,
|
|
834
|
+
) => void) &
|
|
835
|
+
((
|
|
836
|
+
fn: () => void,
|
|
837
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
838
|
+
errorLike?: ErrorConstructor | Error | null,
|
|
839
|
+
errMsgMatcher?: RegExp | string | null,
|
|
840
|
+
) => void);
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Compares two values using operator.
|
|
844
|
+
*
|
|
845
|
+
* @param val1 Left value during comparison.
|
|
846
|
+
* @param operator Comparison operator.
|
|
847
|
+
* @param val2 Right value during comparison.
|
|
848
|
+
*/
|
|
849
|
+
operator: (
|
|
850
|
+
val1: OperatorComparable,
|
|
851
|
+
operator: Operator,
|
|
852
|
+
val2: OperatorComparable,
|
|
853
|
+
) => void;
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Asserts that the target is equal to expected, to within a +/- delta range.
|
|
857
|
+
*
|
|
858
|
+
* @param actual Actual value
|
|
859
|
+
* @param expected Potential expected value.
|
|
860
|
+
* @param delta Maximum difference between values.
|
|
861
|
+
*/
|
|
862
|
+
closeTo: (actual: number, expected: number, delta: number) => void;
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Asserts that the target is equal to expected, to within a +/- delta range.
|
|
866
|
+
*
|
|
867
|
+
* @param actual Actual value
|
|
868
|
+
* @param expected Potential expected value.
|
|
869
|
+
* @param delta Maximum difference between values.
|
|
870
|
+
*/
|
|
871
|
+
approximately: (act: number, exp: number, delta: number) => void;
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Asserts that set1 and set2 have the same members. Order is not take into account.
|
|
875
|
+
*
|
|
876
|
+
* T Type of set values.
|
|
877
|
+
* @param set1 Actual set of values.
|
|
878
|
+
* @param set2 Potential expected set of values.
|
|
879
|
+
*/
|
|
880
|
+
sameMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Asserts that set1 and set2 have the same members using deep equality checking.
|
|
884
|
+
* Order is not take into account.
|
|
885
|
+
*
|
|
886
|
+
* T Type of set values.
|
|
887
|
+
* @param set1 Actual set of values.
|
|
888
|
+
* @param set2 Potential expected set of values.
|
|
889
|
+
*/
|
|
890
|
+
sameDeepMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Asserts that `set1` and `set2` don't have the same members in any order.
|
|
894
|
+
* Uses a deep equality check.
|
|
895
|
+
*
|
|
896
|
+
* T Type of set values.
|
|
897
|
+
* @param set1
|
|
898
|
+
* @param set2
|
|
899
|
+
*/
|
|
900
|
+
notSameDeepMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Asserts that set1 and set2 have the same members in the same order.
|
|
904
|
+
* Uses a strict equality check (===).
|
|
905
|
+
*
|
|
906
|
+
* T Type of set values.
|
|
907
|
+
* @param set1 Actual set of values.
|
|
908
|
+
* @param set2 Potential expected set of values.
|
|
909
|
+
*/
|
|
910
|
+
sameOrderedMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Asserts that set1 and set2 don’t have the same members in the same order.
|
|
914
|
+
* Uses a strict equality check (===).
|
|
915
|
+
*
|
|
916
|
+
* T Type of set values.
|
|
917
|
+
* @param set1 Actual set of values.
|
|
918
|
+
* @param set2 Potential expected set of values.
|
|
919
|
+
*/
|
|
920
|
+
notSameOrderedMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Asserts that set1 and set2 have the same members in the same order.
|
|
924
|
+
* Uses a deep equality check.
|
|
925
|
+
*
|
|
926
|
+
* T Type of set values.
|
|
927
|
+
* @param set1 Actual set of values.
|
|
928
|
+
* @param set2 Potential expected set of values.
|
|
929
|
+
*/
|
|
930
|
+
sameDeepOrderedMembers: <T>(set1: readonly T[], set2: readonly T[]) => void;
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Asserts that set1 and set2 don’t have the same members in the same order.
|
|
934
|
+
* Uses a deep equality check.
|
|
935
|
+
*
|
|
936
|
+
* T Type of set values.
|
|
937
|
+
* @param set1 Actual set of values.
|
|
938
|
+
* @param set2 Potential expected set of values.
|
|
939
|
+
*/
|
|
940
|
+
notSameDeepOrderedMembers: <T>(
|
|
941
|
+
set1: readonly T[],
|
|
942
|
+
set2: readonly T[],
|
|
943
|
+
) => void;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Asserts that subset is included in superset in the same order beginning with the first element in superset.
|
|
947
|
+
* Uses a strict equality check (===).
|
|
948
|
+
*
|
|
949
|
+
* T Type of set values.
|
|
950
|
+
* @param superset Actual set of values.
|
|
951
|
+
* @param subset Potential contained set of values.
|
|
952
|
+
*/
|
|
953
|
+
includeOrderedMembers: <T>(
|
|
954
|
+
superset: readonly T[],
|
|
955
|
+
subset: readonly T[],
|
|
956
|
+
) => void;
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Asserts that subset isn’t included in superset in the same order beginning with the first element in superset.
|
|
960
|
+
* Uses a strict equality check (===).
|
|
961
|
+
*
|
|
962
|
+
* T Type of set values.
|
|
963
|
+
* @param superset Actual set of values.
|
|
964
|
+
* @param subset Potential contained set of values.
|
|
965
|
+
*/
|
|
966
|
+
notIncludeOrderedMembers: <T>(
|
|
967
|
+
superset: readonly T[],
|
|
968
|
+
subset: readonly T[],
|
|
969
|
+
) => void;
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* Asserts that subset is included in superset in the same order beginning with the first element in superset.
|
|
973
|
+
* Uses a deep equality check.
|
|
974
|
+
*
|
|
975
|
+
* T Type of set values.
|
|
976
|
+
* @param superset Actual set of values.
|
|
977
|
+
* @param subset Potential contained set of values.
|
|
978
|
+
*/
|
|
979
|
+
includeDeepOrderedMembers: <T>(
|
|
980
|
+
superset: readonly T[],
|
|
981
|
+
subset: readonly T[],
|
|
982
|
+
) => void;
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Asserts that subset isn’t included in superset in the same order beginning with the first element in superset.
|
|
986
|
+
* Uses a deep equality check.
|
|
987
|
+
*
|
|
988
|
+
* T Type of set values.
|
|
989
|
+
* @param superset Actual set of values.
|
|
990
|
+
* @param subset Potential contained set of values.
|
|
991
|
+
*/
|
|
992
|
+
notIncludeDeepOrderedMembers: <T>(
|
|
993
|
+
superset: readonly T[],
|
|
994
|
+
subset: readonly T[],
|
|
995
|
+
) => void;
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Asserts that subset is included in superset. Order is not take into account.
|
|
999
|
+
*
|
|
1000
|
+
* T Type of set values.
|
|
1001
|
+
* @param superset Actual set of values.
|
|
1002
|
+
* @param subset Potential contained set of values.
|
|
1003
|
+
*/
|
|
1004
|
+
includeMembers: <T>(superset: readonly T[], subset: readonly T[]) => void;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* Asserts that subset isn’t included in superset in any order.
|
|
1008
|
+
* Uses a strict equality check (===). Duplicates are ignored.
|
|
1009
|
+
*
|
|
1010
|
+
* T Type of set values.
|
|
1011
|
+
* @param superset Actual set of values.
|
|
1012
|
+
* @param subset Potential not contained set of values.
|
|
1013
|
+
*/
|
|
1014
|
+
notIncludeMembers: <T>(superset: readonly T[], subset: readonly T[]) => void;
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* Asserts that subset is included in superset using deep equality checking.
|
|
1018
|
+
* Order is not take into account.
|
|
1019
|
+
*
|
|
1020
|
+
* T Type of set values.
|
|
1021
|
+
* @param superset Actual set of values.
|
|
1022
|
+
* @param subset Potential contained set of values.
|
|
1023
|
+
*/
|
|
1024
|
+
includeDeepMembers: <T>(superset: readonly T[], subset: readonly T[]) => void;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Asserts that `subset` isn't included in `superset` in any order. Uses a
|
|
1028
|
+
* deep equality check. Duplicates are ignored.
|
|
1029
|
+
*
|
|
1030
|
+
* assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members');
|
|
1031
|
+
*
|
|
1032
|
+
* T Type of set values.
|
|
1033
|
+
* @param superset Actual set of values.
|
|
1034
|
+
* @param subset Potential contained set of values.
|
|
1035
|
+
*/
|
|
1036
|
+
notIncludeDeepMembers: <T>(
|
|
1037
|
+
superset: readonly T[],
|
|
1038
|
+
subset: readonly T[],
|
|
1039
|
+
) => void;
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Asserts that non-object, non-array value inList appears in the flat array list.
|
|
1043
|
+
*
|
|
1044
|
+
* T Type of list values.
|
|
1045
|
+
* @param inList Value expected to be in the list.
|
|
1046
|
+
* @param list List of values.
|
|
1047
|
+
*/
|
|
1048
|
+
oneOf: <T>(inList: T, list: readonly T[]) => void;
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Asserts that a function changes the value of a property.
|
|
1052
|
+
*
|
|
1053
|
+
* T Type of object.
|
|
1054
|
+
* @param modifier Function to run.
|
|
1055
|
+
* @param object Container object.
|
|
1056
|
+
* @param property Property of object expected to be modified.
|
|
1057
|
+
*/
|
|
1058
|
+
changes: <T>(
|
|
1059
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1060
|
+
modifier: Function,
|
|
1061
|
+
object: T,
|
|
1062
|
+
property: string /* keyof T */,
|
|
1063
|
+
) => void;
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* Asserts that a function changes the value of a property by an amount (delta).
|
|
1067
|
+
*
|
|
1068
|
+
* @param modifier function
|
|
1069
|
+
* @param object or getter function
|
|
1070
|
+
* @param property name _optional_
|
|
1071
|
+
* @param change amount (delta)
|
|
1072
|
+
*/
|
|
1073
|
+
changesBy: (<T>(
|
|
1074
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1075
|
+
modifier: Function,
|
|
1076
|
+
object: T,
|
|
1077
|
+
property: string /* keyof T */,
|
|
1078
|
+
change: number,
|
|
1079
|
+
) => void) &
|
|
1080
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1081
|
+
(<T>(modifier: Function, object: T, change: number) => void);
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* Asserts that a function does not change the value of a property.
|
|
1085
|
+
*
|
|
1086
|
+
* T Type of object.
|
|
1087
|
+
* @param modifier Function to run.
|
|
1088
|
+
* @param object Container object.
|
|
1089
|
+
* @param property Property of object expected not to be modified.
|
|
1090
|
+
*/
|
|
1091
|
+
doesNotChange: <T>(
|
|
1092
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1093
|
+
modifier: Function,
|
|
1094
|
+
object: T,
|
|
1095
|
+
property: string /* keyof T */,
|
|
1096
|
+
) => void;
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Asserts that a function increases an object property.
|
|
1100
|
+
*
|
|
1101
|
+
* T Type of object.
|
|
1102
|
+
* @param modifier Function to run.
|
|
1103
|
+
* @param object Container object.
|
|
1104
|
+
* @param property Property of object expected to be increased.
|
|
1105
|
+
*/
|
|
1106
|
+
increases: <T>(
|
|
1107
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1108
|
+
modifier: Function,
|
|
1109
|
+
object: T,
|
|
1110
|
+
property: string /* keyof T */,
|
|
1111
|
+
) => void;
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* Asserts that a function increases a numeric object property or a function's return value by an amount (delta).
|
|
1115
|
+
*
|
|
1116
|
+
* T Type of object or function.
|
|
1117
|
+
* @param modifier function
|
|
1118
|
+
* @param object or getter function
|
|
1119
|
+
* @param property name _optional_
|
|
1120
|
+
* @param change amount (delta)
|
|
1121
|
+
*/
|
|
1122
|
+
increasesBy: (<T>(
|
|
1123
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1124
|
+
modifier: Function,
|
|
1125
|
+
object: T,
|
|
1126
|
+
property: string /* keyof T */,
|
|
1127
|
+
change: number,
|
|
1128
|
+
) => void) &
|
|
1129
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1130
|
+
(<T>(modifier: Function, object: T, change: number) => void);
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* Asserts that a function does not increase an object property.
|
|
1134
|
+
*
|
|
1135
|
+
* T Type of object.
|
|
1136
|
+
* @param modifier Function to run.
|
|
1137
|
+
* @param object Container object.
|
|
1138
|
+
* @param property Property of object expected not to be increased.
|
|
1139
|
+
*/
|
|
1140
|
+
doesNotIncrease: <T>(
|
|
1141
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1142
|
+
modifier: Function,
|
|
1143
|
+
object: T,
|
|
1144
|
+
property: string /* keyof T */,
|
|
1145
|
+
) => void;
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* Asserts that a function does not increase a numeric object property or function's return value by an amount (delta).
|
|
1149
|
+
*
|
|
1150
|
+
* T Type of object or function.
|
|
1151
|
+
* @param modifier function
|
|
1152
|
+
* @param object or getter function
|
|
1153
|
+
* @param property name _optional_
|
|
1154
|
+
* @param change amount (delta)
|
|
1155
|
+
*/
|
|
1156
|
+
|
|
1157
|
+
increasesButNotBy: (<T>(
|
|
1158
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1159
|
+
modifier: Function,
|
|
1160
|
+
object: T,
|
|
1161
|
+
property: string /* keyof T */,
|
|
1162
|
+
change: number,
|
|
1163
|
+
) => void) &
|
|
1164
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1165
|
+
(<T>(modifier: Function, object: T, change: number) => void);
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* Asserts that a function decreases an object property.
|
|
1169
|
+
*
|
|
1170
|
+
* T Type of object.
|
|
1171
|
+
* @param modifier Function to run.
|
|
1172
|
+
* @param object Container object.
|
|
1173
|
+
* @param property Property of object expected to be decreased.
|
|
1174
|
+
*/
|
|
1175
|
+
decreases: <T>(
|
|
1176
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1177
|
+
modifier: Function,
|
|
1178
|
+
object: T,
|
|
1179
|
+
property: string /* keyof T */,
|
|
1180
|
+
) => void;
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Asserts that a function decreases a numeric object property or a function's return value by an amount (delta)
|
|
1184
|
+
*
|
|
1185
|
+
* T Type of object or function.
|
|
1186
|
+
* @param modifier function
|
|
1187
|
+
* @param object or getter function
|
|
1188
|
+
* @param property name _optional_
|
|
1189
|
+
* @param change amount (delta)
|
|
1190
|
+
*/
|
|
1191
|
+
|
|
1192
|
+
decreasesBy: (<T>(
|
|
1193
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1194
|
+
modifier: Function,
|
|
1195
|
+
object: T,
|
|
1196
|
+
property: string /* keyof T */,
|
|
1197
|
+
change: number,
|
|
1198
|
+
) => void) &
|
|
1199
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1200
|
+
(<T>(modifier: Function, object: T, change: number) => void);
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Asserts that a function does not decrease an object property.
|
|
1204
|
+
*
|
|
1205
|
+
* T Type of object.
|
|
1206
|
+
* @param modifier Function to run.
|
|
1207
|
+
* @param object Container object.
|
|
1208
|
+
* @param property Property of object expected not to be decreased.
|
|
1209
|
+
*/
|
|
1210
|
+
doesNotDecrease: <T>(
|
|
1211
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1212
|
+
modifier: Function,
|
|
1213
|
+
object: T,
|
|
1214
|
+
property: string /* keyof T */,
|
|
1215
|
+
) => void;
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)
|
|
1219
|
+
*
|
|
1220
|
+
* T Type of object or function.
|
|
1221
|
+
* @param modifier function
|
|
1222
|
+
* @param object or getter function
|
|
1223
|
+
* @param property name _optional_
|
|
1224
|
+
* @param change amount (delta)
|
|
1225
|
+
*/
|
|
1226
|
+
|
|
1227
|
+
doesNotDecreaseBy: (<T>(
|
|
1228
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1229
|
+
modifier: Function,
|
|
1230
|
+
object: T,
|
|
1231
|
+
property: string /* keyof T */,
|
|
1232
|
+
change: number,
|
|
1233
|
+
) => void) &
|
|
1234
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1235
|
+
(<T>(modifier: Function, object: T, change: number) => void);
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta)
|
|
1239
|
+
*
|
|
1240
|
+
* T Type of object or function.
|
|
1241
|
+
* @param modifier function
|
|
1242
|
+
* @param object or getter function
|
|
1243
|
+
* @param property name _optional_
|
|
1244
|
+
* @param change amount (delta)
|
|
1245
|
+
*/
|
|
1246
|
+
|
|
1247
|
+
decreasesButNotBy: (<T>(
|
|
1248
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1249
|
+
modifier: Function,
|
|
1250
|
+
object: T,
|
|
1251
|
+
property: string /* keyof T */,
|
|
1252
|
+
change: number,
|
|
1253
|
+
) => void) &
|
|
1254
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
1255
|
+
(<T>(modifier: Function, object: T, change: number) => void);
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Asserts if value is not a false value, and throws if it is a true value.
|
|
1259
|
+
*
|
|
1260
|
+
* T Type of object.
|
|
1261
|
+
* @param object Actual value.
|
|
1262
|
+
* @remarks This is added to allow for chai to be a drop-in replacement for
|
|
1263
|
+
* Node’s assert class.
|
|
1264
|
+
*/
|
|
1265
|
+
ifError: <T>(object: T) => void;
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* Asserts that object is extensible (can have new properties added to it).
|
|
1269
|
+
*
|
|
1270
|
+
* T Type of object
|
|
1271
|
+
* @param object Actual value.
|
|
1272
|
+
*/
|
|
1273
|
+
isExtensible: <T>(object: T) => void;
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* Asserts that object is extensible (can have new properties added to it).
|
|
1277
|
+
*
|
|
1278
|
+
* T Type of object
|
|
1279
|
+
* @param object Actual value.
|
|
1280
|
+
*/
|
|
1281
|
+
extensible: <T>(object: T) => void;
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Asserts that object is not extensible.
|
|
1285
|
+
*
|
|
1286
|
+
* T Type of object
|
|
1287
|
+
* @param object Actual value.
|
|
1288
|
+
*/
|
|
1289
|
+
isNotExtensible: <T>(object: T) => void;
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Asserts that object is not extensible.
|
|
1293
|
+
*
|
|
1294
|
+
* T Type of object
|
|
1295
|
+
* @param object Actual value.
|
|
1296
|
+
*/
|
|
1297
|
+
notExtensible: <T>(object: T) => void;
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* Asserts that object is sealed (can have new properties added to it
|
|
1301
|
+
* and its existing properties cannot be removed).
|
|
1302
|
+
*
|
|
1303
|
+
* T Type of object
|
|
1304
|
+
* @param object Actual value.
|
|
1305
|
+
*/
|
|
1306
|
+
isSealed: <T>(object: T) => void;
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* Asserts that object is sealed (can have new properties added to it
|
|
1310
|
+
* and its existing properties cannot be removed).
|
|
1311
|
+
*
|
|
1312
|
+
* T Type of object
|
|
1313
|
+
* @param object Actual value.
|
|
1314
|
+
*/
|
|
1315
|
+
sealed: <T>(object: T) => void;
|
|
1316
|
+
|
|
1317
|
+
/**
|
|
1318
|
+
* Asserts that object is not sealed.
|
|
1319
|
+
*
|
|
1320
|
+
* T Type of object
|
|
1321
|
+
* @param object Actual value.
|
|
1322
|
+
*/
|
|
1323
|
+
isNotSealed: <T>(object: T) => void;
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* Asserts that object is not sealed.
|
|
1327
|
+
*
|
|
1328
|
+
* T Type of object
|
|
1329
|
+
* @param object Actual value.
|
|
1330
|
+
*/
|
|
1331
|
+
notSealed: <T>(object: T) => void;
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* Asserts that object is frozen (cannot have new properties added to it
|
|
1335
|
+
* and its existing properties cannot be removed).
|
|
1336
|
+
*
|
|
1337
|
+
* T Type of object
|
|
1338
|
+
* @param object Actual value.
|
|
1339
|
+
*/
|
|
1340
|
+
isFrozen: <T>(object: T) => void;
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* Asserts that object is frozen (cannot have new properties added to it
|
|
1344
|
+
* and its existing properties cannot be removed).
|
|
1345
|
+
*
|
|
1346
|
+
* T Type of object
|
|
1347
|
+
* @param object Actual value.
|
|
1348
|
+
*/
|
|
1349
|
+
frozen: <T>(object: T) => void;
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* Asserts that object is not frozen (cannot have new properties added to it
|
|
1353
|
+
* and its existing properties cannot be removed).
|
|
1354
|
+
*
|
|
1355
|
+
* T Type of object
|
|
1356
|
+
* @param object Actual value.
|
|
1357
|
+
*/
|
|
1358
|
+
isNotFrozen: <T>(object: T) => void;
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* Asserts that object is not frozen (cannot have new properties added to it
|
|
1362
|
+
* and its existing properties cannot be removed).
|
|
1363
|
+
*
|
|
1364
|
+
* T Type of object
|
|
1365
|
+
* @param object Actual value.
|
|
1366
|
+
*/
|
|
1367
|
+
notFrozen: <T>(object: T) => void;
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* Asserts that the target does not contain any values. For arrays and
|
|
1371
|
+
* strings, it checks the length property. For Map and Set instances, it
|
|
1372
|
+
* checks the size property. For non-function objects, it gets the count
|
|
1373
|
+
* of own enumerable string keys.
|
|
1374
|
+
*
|
|
1375
|
+
* T Type of object
|
|
1376
|
+
* @param object Actual value.
|
|
1377
|
+
*/
|
|
1378
|
+
isEmpty: <T>(object: T) => void;
|
|
1379
|
+
|
|
1380
|
+
/**
|
|
1381
|
+
* Asserts that the target contains values. For arrays and strings, it checks
|
|
1382
|
+
* the length property. For Map and Set instances, it checks the size property.
|
|
1383
|
+
* For non-function objects, it gets the count of own enumerable string keys.
|
|
1384
|
+
*
|
|
1385
|
+
* T Type of object.
|
|
1386
|
+
* @param object Object to test.
|
|
1387
|
+
*/
|
|
1388
|
+
isNotEmpty: <T>(object: T) => void;
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Asserts that `object` has at least one of the `keys` provided.
|
|
1392
|
+
* You can also provide a single object instead of a `keys` array and its keys
|
|
1393
|
+
* will be used as the expected set of keys.
|
|
1394
|
+
*
|
|
1395
|
+
* T Type of object.
|
|
1396
|
+
* @param object Object to test.
|
|
1397
|
+
* @param keys Keys to check
|
|
1398
|
+
*/
|
|
1399
|
+
hasAnyKeys: <T>(
|
|
1400
|
+
object: T,
|
|
1401
|
+
keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
|
|
1402
|
+
) => void;
|
|
1403
|
+
|
|
1404
|
+
/**
|
|
1405
|
+
* Asserts that `object` has all and only all of the `keys` provided.
|
|
1406
|
+
* You can also provide a single object instead of a `keys` array and its keys
|
|
1407
|
+
* will be used as the expected set of keys.
|
|
1408
|
+
*
|
|
1409
|
+
* T Type of object.
|
|
1410
|
+
* @param object Object to test.
|
|
1411
|
+
* @param keys Keys to check
|
|
1412
|
+
*/
|
|
1413
|
+
hasAllKeys: <T>(
|
|
1414
|
+
object: T,
|
|
1415
|
+
keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
|
|
1416
|
+
) => void;
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* Asserts that `object` has all of the `keys` provided but may have more keys not listed.
|
|
1420
|
+
* You can also provide a single object instead of a `keys` array and its keys
|
|
1421
|
+
* will be used as the expected set of keys.
|
|
1422
|
+
*
|
|
1423
|
+
* T Type of object.
|
|
1424
|
+
* @param object Object to test.
|
|
1425
|
+
* @param keys Keys to check
|
|
1426
|
+
*/
|
|
1427
|
+
containsAllKeys: <T>(
|
|
1428
|
+
object: T,
|
|
1429
|
+
keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
|
|
1430
|
+
) => void;
|
|
1431
|
+
|
|
1432
|
+
/**
|
|
1433
|
+
* Asserts that `object` has none of the `keys` provided.
|
|
1434
|
+
* You can also provide a single object instead of a `keys` array and its keys
|
|
1435
|
+
* will be used as the expected set of keys.
|
|
1436
|
+
*
|
|
1437
|
+
* T Type of object.
|
|
1438
|
+
* @param object Object to test.
|
|
1439
|
+
* @param keys Keys to check
|
|
1440
|
+
*/
|
|
1441
|
+
doesNotHaveAnyKeys: <T>(
|
|
1442
|
+
object: T,
|
|
1443
|
+
keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
|
|
1444
|
+
) => void;
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* Asserts that `object` does not have at least one of the `keys` provided.
|
|
1448
|
+
* You can also provide a single object instead of a `keys` array and its keys
|
|
1449
|
+
* will be used as the expected set of keys.
|
|
1450
|
+
*
|
|
1451
|
+
* T Type of object.
|
|
1452
|
+
* @param object Object to test.
|
|
1453
|
+
* @param keys Keys to check
|
|
1454
|
+
*/
|
|
1455
|
+
doesNotHaveAllKeys: <T>(
|
|
1456
|
+
object: T,
|
|
1457
|
+
keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
|
|
1458
|
+
) => void;
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* Asserts that `object` has at least one of the `keys` provided.
|
|
1462
|
+
* Since Sets and Maps can have objects as keys you can use this assertion to perform
|
|
1463
|
+
* a deep comparison.
|
|
1464
|
+
* You can also provide a single object instead of a `keys` array and its keys
|
|
1465
|
+
* will be used as the expected set of keys.
|
|
1466
|
+
*
|
|
1467
|
+
* T Type of object.
|
|
1468
|
+
* @param object Object to test.
|
|
1469
|
+
* @param keys Keys to check
|
|
1470
|
+
*/
|
|
1471
|
+
hasAnyDeepKeys: <T>(
|
|
1472
|
+
object: T,
|
|
1473
|
+
keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
|
|
1474
|
+
) => void;
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* Asserts that `object` has all and only all of the `keys` provided.
|
|
1478
|
+
* Since Sets and Maps can have objects as keys you can use this assertion to perform
|
|
1479
|
+
* a deep comparison.
|
|
1480
|
+
* You can also provide a single object instead of a `keys` array and its keys
|
|
1481
|
+
* will be used as the expected set of keys.
|
|
1482
|
+
*
|
|
1483
|
+
* T Type of object.
|
|
1484
|
+
* @param object Object to test.
|
|
1485
|
+
* @param keys Keys to check
|
|
1486
|
+
*/
|
|
1487
|
+
hasAllDeepKeys: <T>(
|
|
1488
|
+
object: T,
|
|
1489
|
+
keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
|
|
1490
|
+
) => void;
|
|
1491
|
+
|
|
1492
|
+
/**
|
|
1493
|
+
* Asserts that `object` contains all of the `keys` provided.
|
|
1494
|
+
* Since Sets and Maps can have objects as keys you can use this assertion to perform
|
|
1495
|
+
* a deep comparison.
|
|
1496
|
+
* You can also provide a single object instead of a `keys` array and its keys
|
|
1497
|
+
* will be used as the expected set of keys.
|
|
1498
|
+
*
|
|
1499
|
+
* T Type of object.
|
|
1500
|
+
* @param object Object to test.
|
|
1501
|
+
* @param keys Keys to check
|
|
1502
|
+
*/
|
|
1503
|
+
containsAllDeepKeys: <T>(
|
|
1504
|
+
object: T,
|
|
1505
|
+
keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
|
|
1506
|
+
) => void;
|
|
1507
|
+
|
|
1508
|
+
/**
|
|
1509
|
+
* Asserts that `object` contains all of the `keys` provided.
|
|
1510
|
+
* Since Sets and Maps can have objects as keys you can use this assertion to perform
|
|
1511
|
+
* a deep comparison.
|
|
1512
|
+
* You can also provide a single object instead of a `keys` array and its keys
|
|
1513
|
+
* will be used as the expected set of keys.
|
|
1514
|
+
*
|
|
1515
|
+
* T Type of object.
|
|
1516
|
+
* @param object Object to test.
|
|
1517
|
+
* @param keys Keys to check
|
|
1518
|
+
*/
|
|
1519
|
+
doesNotHaveAnyDeepKeys: <T>(
|
|
1520
|
+
object: T,
|
|
1521
|
+
keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
|
|
1522
|
+
) => void;
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* Asserts that `object` contains all of the `keys` provided.
|
|
1526
|
+
* Since Sets and Maps can have objects as keys you can use this assertion to perform
|
|
1527
|
+
* a deep comparison.
|
|
1528
|
+
* You can also provide a single object instead of a `keys` array and its keys
|
|
1529
|
+
* will be used as the expected set of keys.
|
|
1530
|
+
*
|
|
1531
|
+
* T Type of object.
|
|
1532
|
+
* @param object Object to test.
|
|
1533
|
+
* @param keys Keys to check
|
|
1534
|
+
*/
|
|
1535
|
+
doesNotHaveAllDeepKeys: <T>(
|
|
1536
|
+
object: T,
|
|
1537
|
+
keys: readonly (object | string)[] | Readonly<Record<string, unknown>>,
|
|
1538
|
+
) => void;
|
|
1539
|
+
|
|
1540
|
+
/**
|
|
1541
|
+
* Asserts that object has a direct or inherited property named by property,
|
|
1542
|
+
* which can be a string using dot- and bracket-notation for nested reference.
|
|
1543
|
+
*
|
|
1544
|
+
* T Type of object.
|
|
1545
|
+
* @param object Object to test.
|
|
1546
|
+
* @param property Property to test.
|
|
1547
|
+
*/
|
|
1548
|
+
nestedProperty: <T>(object: T, property: string) => void;
|
|
1549
|
+
|
|
1550
|
+
/**
|
|
1551
|
+
* Asserts that object does not have a property named by property,
|
|
1552
|
+
* which can be a string using dot- and bracket-notation for nested reference.
|
|
1553
|
+
* The property cannot exist on the object nor anywhere in its prototype chain.
|
|
1554
|
+
*
|
|
1555
|
+
* T Type of object.
|
|
1556
|
+
* @param object Object to test.
|
|
1557
|
+
* @param property Property to test.
|
|
1558
|
+
*/
|
|
1559
|
+
notNestedProperty: <T>(object: T, property: string) => void;
|
|
1560
|
+
|
|
1561
|
+
/**
|
|
1562
|
+
* Asserts that object has a property named by property with value given by value.
|
|
1563
|
+
* property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).
|
|
1564
|
+
*
|
|
1565
|
+
* T Type of object.
|
|
1566
|
+
* @param object Object to test.
|
|
1567
|
+
* @param property Property to test.
|
|
1568
|
+
* @param value Value to test.
|
|
1569
|
+
*/
|
|
1570
|
+
nestedPropertyVal: <T>(object: T, property: string, value: unknown) => void;
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* Asserts that object does not have a property named by property with value given by value.
|
|
1574
|
+
* property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===).
|
|
1575
|
+
*
|
|
1576
|
+
* T Type of object.
|
|
1577
|
+
* @param object Object to test.
|
|
1578
|
+
* @param property Property to test.
|
|
1579
|
+
* @param value Value to test.
|
|
1580
|
+
*/
|
|
1581
|
+
notNestedPropertyVal: <T>(
|
|
1582
|
+
object: T,
|
|
1583
|
+
property: string,
|
|
1584
|
+
value: unknown,
|
|
1585
|
+
) => void;
|
|
1586
|
+
|
|
1587
|
+
/**
|
|
1588
|
+
* Asserts that object has a property named by property with a value given by value.
|
|
1589
|
+
* property can use dot- and bracket-notation for nested reference. Uses a deep equality check.
|
|
1590
|
+
*
|
|
1591
|
+
* T Type of object.
|
|
1592
|
+
* @param object Object to test.
|
|
1593
|
+
* @param property Property to test.
|
|
1594
|
+
* @param value Value to test.
|
|
1595
|
+
*/
|
|
1596
|
+
deepNestedPropertyVal: <T>(
|
|
1597
|
+
object: T,
|
|
1598
|
+
property: string,
|
|
1599
|
+
value: unknown,
|
|
1600
|
+
) => void;
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* Asserts that object does not have a property named by property with value given by value.
|
|
1604
|
+
* property can use dot- and bracket-notation for nested reference. Uses a deep equality check.
|
|
1605
|
+
*
|
|
1606
|
+
* T Type of object.
|
|
1607
|
+
* @param object Object to test.
|
|
1608
|
+
* @param property Property to test.
|
|
1609
|
+
* @param value Value to test.
|
|
1610
|
+
*/
|
|
1611
|
+
notDeepNestedPropertyVal: <T>(
|
|
1612
|
+
object: T,
|
|
1613
|
+
property: string,
|
|
1614
|
+
value: unknown,
|
|
1615
|
+
) => void;
|
|
1616
|
+
}>;
|