1 |
|
2 |
|
3 | interface CustomMatchers<R> extends Record<string, any> {
|
4 | |
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | pass(message: string): R;
|
11 |
|
12 | |
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | fail(message: string): R;
|
19 |
|
20 | |
21 |
|
22 |
|
23 | toBeEmpty(): R;
|
24 |
|
25 | |
26 |
|
27 |
|
28 |
|
29 | toBeOneOf<E = unknown>(members: readonly E[]): R;
|
30 |
|
31 | |
32 |
|
33 |
|
34 | toBeNil(): R;
|
35 |
|
36 | |
37 |
|
38 |
|
39 |
|
40 | toSatisfy<E = any>(predicate: (x: E) => boolean): R;
|
41 |
|
42 | /**
|
43 | * Use `.toBeArray` when checking if a value is an `Array`.
|
44 | */
|
45 | toBeArray(): R;
|
46 |
|
47 | /**
|
48 | * Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x.
|
49 | * @param {Number} x
|
50 | */
|
51 | toBeArrayOfSize(x: number): R;
|
52 |
|
53 | /**
|
54 | * Use `.toBeAfter` when checking if a date occurs after `date`.
|
55 | * @param {Date} date
|
56 | */
|
57 | toBeAfter(date: Date): R;
|
58 |
|
59 | /**
|
60 | * Use `.toBeBefore` when checking if a date occurs before `date`.
|
61 | * @param {Date} date
|
62 | */
|
63 | toBeBefore(date: Date): R;
|
64 |
|
65 | /**
|
66 | * Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set.
|
67 | * @param {Array.<*>} members
|
68 | */
|
69 | toIncludeAllMembers<E = unknown>(members: readonly E[]): R;
|
70 |
|
71 | /**
|
72 | * Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set.
|
73 | * @param {Array.<*>} members
|
74 | */
|
75 | toIncludeAnyMembers<E = unknown>(members: readonly E[]): R;
|
76 |
|
77 | /**
|
78 | * Use `.toIncludeSameMembers` when checking if two arrays contain equal values, in any order.
|
79 | * @param {Array.<*>} members
|
80 | */
|
81 | toIncludeSameMembers<E = unknown>(members: readonly E[]): R;
|
82 |
|
83 | /**
|
84 | * Use `.toPartiallyContain` when checking if any array value matches the partial member.
|
85 | * @param {*} member
|
86 | */
|
87 | toPartiallyContain<E = unknown>(member: E): R;
|
88 |
|
89 | /**
|
90 | * Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array.
|
91 | * @param {Function} predicate
|
92 | */
|
93 | toSatisfyAll<E = any>(predicate: (x: E) => boolean): R;
|
94 |
|
95 | /**
|
96 | * Use `.toSatisfyAny` when you want to use a custom matcher by supplying a predicate function that returns `true` for any matching value in an array.
|
97 | * @param {Function} predicate
|
98 | */
|
99 | toSatisfyAny(predicate: (x: any) => boolean): R;
|
100 |
|
101 | /**
|
102 | * Use `.toBeBoolean` when checking if a value is a `Boolean`.
|
103 | */
|
104 | toBeBoolean(): R;
|
105 |
|
106 | /**
|
107 | * Use `.toBeTrue` when checking a value is equal (===) to `true`.
|
108 | */
|
109 | toBeTrue(): R;
|
110 |
|
111 | /**
|
112 | * Use `.toBeFalse` when checking a value is equal (===) to `false`.
|
113 | */
|
114 | toBeFalse(): R;
|
115 |
|
116 | /**
|
117 | * Use `.toBeDate` when checking if a value is a `Date`.
|
118 | */
|
119 | toBeDate(): R;
|
120 |
|
121 | /**
|
122 | * Use `.toBeValidDate` when checking if a value is a `valid Date`.
|
123 | */
|
124 | toBeValidDate(): R;
|
125 |
|
126 | /**
|
127 | * Use `.toBeFunction` when checking if a value is a `Function`.
|
128 | */
|
129 | toBeFunction(): R;
|
130 |
|
131 | /**
|
132 | * Use `.toBeDateString` when checking if a value is a valid date string.
|
133 | */
|
134 | toBeDateString(): R;
|
135 |
|
136 | /**
|
137 | * Use `.toBeHexadecimal` when checking if a value is a valid HTML hex color.
|
138 | */
|
139 | toBeHexadecimal(): R;
|
140 |
|
141 | /**
|
142 | * Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`.
|
143 | *
|
144 | * Note: Required Jest version >=23
|
145 | *
|
146 | * @param {Mock} mock
|
147 | * @param {boolean} [failIfNoSecondInvocation=true]
|
148 | */
|
149 | toHaveBeenCalledBefore(mock: jest.MockInstance<any, any[]>, failIfNoSecondInvocation?: boolean): R;
|
150 |
|
151 | /**
|
152 | * Use `.toHaveBeenCalledAfter` when checking if a `Mock` was called after another `Mock`.
|
153 | *
|
154 | * Note: Required Jest version >=23
|
155 | *
|
156 | * @param {Mock} mock
|
157 | * @param {boolean} [failIfNoFirstInvocation=true]
|
158 | */
|
159 | toHaveBeenCalledAfter(mock: jest.MockInstance<any, any[]>, failIfNoFirstInvocation?: boolean): R;
|
160 |
|
161 | /**
|
162 | * Use `.toHaveBeenCalledOnce` to check if a `Mock` was called exactly one time.
|
163 | */
|
164 | toHaveBeenCalledOnce(): R;
|
165 |
|
166 | /**
|
167 | * Use `.toHaveBeenCalledExactlyOnceWith` to check if a `Mock` was called exactly one time with the expected value.
|
168 | */
|
169 | toHaveBeenCalledExactlyOnceWith(...args: unknown[]): R;
|
170 |
|
171 | /**
|
172 | * Use `.toBeNumber` when checking if a value is a `Number`.
|
173 | */
|
174 | toBeNumber(): R;
|
175 |
|
176 | /**
|
177 | * Use `.toBeNaN` when checking a value is `NaN`.
|
178 | */
|
179 | toBeNaN(): R;
|
180 |
|
181 | /**
|
182 | * Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`.
|
183 | */
|
184 | toBeFinite(): R;
|
185 |
|
186 | /**
|
187 | * Use `.toBePositive` when checking if a value is a positive `Number`.
|
188 | */
|
189 | toBePositive(): R;
|
190 |
|
191 | /**
|
192 | * Use `.toBeNegative` when checking if a value is a negative `Number`.
|
193 | */
|
194 | toBeNegative(): R;
|
195 |
|
196 | /**
|
197 | * Use `.toBeEven` when checking if a value is an even `Number`.
|
198 | */
|
199 | toBeEven(): R;
|
200 |
|
201 | /**
|
202 | * Use `.toBeOdd` when checking if a value is an odd `Number`.
|
203 | */
|
204 | toBeOdd(): R;
|
205 |
|
206 | /**
|
207 | * Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive).
|
208 | *
|
209 | * @param {Number} start
|
210 | * @param {Number} end
|
211 | */
|
212 | toBeWithin(start: number, end: number): R;
|
213 |
|
214 | /**
|
215 | * Use `.toBeInRange` when checking if an array has elements in range min (inclusive) and max (inclusive).
|
216 | *
|
217 | * @param min
|
218 | * @param max
|
219 | */
|
220 | toBeInRange(min: number, max: number): R;
|
221 |
|
222 | /**
|
223 | * Use `.toBeObject` when checking if a value is an `Object`.
|
224 | */
|
225 | toBeObject(): R;
|
226 |
|
227 | /**
|
228 | * Use `.toContainKey` when checking if an object contains the provided key.
|
229 | *
|
230 | * @param {String} key
|
231 | */
|
232 | toContainKey(key: string): R;
|
233 |
|
234 | /**
|
235 | * Use `.toContainKeys` when checking if an object has all of the provided keys.
|
236 | *
|
237 | * @param {Array.<String>} keys
|
238 | */
|
239 | toContainKeys<E = unknown>(keys: readonly (keyof E | string)[]): R;
|
240 |
|
241 | /**
|
242 | * Use `.toContainAllKeys` when checking if an object only contains all of the provided keys.
|
243 | *
|
244 | * @param {Array.<String>} keys
|
245 | */
|
246 | toContainAllKeys<E = unknown>(keys: readonly (keyof E | string)[]): R;
|
247 |
|
248 | /**
|
249 | * Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys.
|
250 | *
|
251 | * @param {Array.<String>} keys
|
252 | */
|
253 | toContainAnyKeys<E = unknown>(keys: readonly (keyof E | string)[]): R;
|
254 |
|
255 | /**
|
256 | * Use `.toContainValue` when checking if an object contains the provided value.
|
257 | *
|
258 | * @param {*} value
|
259 | */
|
260 | toContainValue<E = unknown>(value: E): R;
|
261 |
|
262 | /**
|
263 | * Use `.toContainValues` when checking if an object contains all of the provided values.
|
264 | *
|
265 | * @param {Array.<*>} values
|
266 | */
|
267 | toContainValues<E = unknown>(values: readonly E[]): R;
|
268 |
|
269 | /**
|
270 | * Use `.toContainAllValues` when checking if an object only contains all of the provided values.
|
271 | *
|
272 | * @param {Array.<*>} values
|
273 | */
|
274 | toContainAllValues<E = unknown>(values: readonly E[]): R;
|
275 |
|
276 | /**
|
277 | * Use `.toContainAnyValues` when checking if an object contains at least one of the provided values.
|
278 | *
|
279 | * @param {Array.<*>} values
|
280 | */
|
281 | toContainAnyValues<E = unknown>(values: readonly E[]): R;
|
282 |
|
283 | /**
|
284 | * Use `.toContainEntry` when checking if an object contains the provided entry.
|
285 | *
|
286 | * @param {Array.<[keyof E, E[keyof E]>} entry
|
287 | */
|
288 | toContainEntry<E = unknown>(entry: readonly [keyof E, E[keyof E]]): R;
|
289 |
|
290 | /**
|
291 | * Use `.toContainEntries` when checking if an object contains all of the provided entries.
|
292 | *
|
293 | * @param {Array.<Array.<keyof E, E[keyof E]>>} entries
|
294 | */
|
295 | toContainEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): R;
|
296 |
|
297 | /**
|
298 | * Use `.toContainAllEntries` when checking if an object only contains all of the provided entries.
|
299 | *
|
300 | * @param {Array.<Array.<keyof E, E[keyof E]>>} entries
|
301 | */
|
302 | toContainAllEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): R;
|
303 |
|
304 | /**
|
305 | * Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries.
|
306 | *
|
307 | * @param {Array.<Array.<keyof E, E[keyof E]>>} entries
|
308 | */
|
309 | toContainAnyEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): R;
|
310 |
|
311 | /**
|
312 | * Use `.toBeExtensible` when checking if an object is extensible.
|
313 | */
|
314 | toBeExtensible(): R;
|
315 |
|
316 | /**
|
317 | * Use `.toBeFrozen` when checking if an object is frozen.
|
318 | */
|
319 | toBeFrozen(): R;
|
320 |
|
321 | /**
|
322 | * Use `.toBeSealed` when checking if an object is sealed.
|
323 | */
|
324 | toBeSealed(): R;
|
325 |
|
326 | /**
|
327 | * Use `.toResolve` when checking if a promise resolves.
|
328 | */
|
329 | toResolve(): R;
|
330 |
|
331 | /**
|
332 | * Use `.toReject` when checking if a promise rejects.
|
333 | */
|
334 | toReject(): R;
|
335 |
|
336 | /**
|
337 | * Use `.toBeString` when checking if a value is a `String`.
|
338 | */
|
339 | toBeString(): R;
|
340 |
|
341 | /**
|
342 | * Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings.
|
343 | *
|
344 | * @param {String} string
|
345 | */
|
346 | toEqualCaseInsensitive(string: string): R;
|
347 |
|
348 | /**
|
349 | * Use `.toStartWith` when checking if a `String` starts with a given `String` prefix.
|
350 | *
|
351 | * @param {String} prefix
|
352 | */
|
353 | toStartWith(prefix: string): R;
|
354 |
|
355 | /**
|
356 | * Use `.toEndWith` when checking if a `String` ends with a given `String` suffix.
|
357 | *
|
358 | * @param {String} suffix
|
359 | */
|
360 | toEndWith(suffix: string): R;
|
361 |
|
362 | /**
|
363 | * Use `.toInclude` when checking if a `String` includes the given `String` substring.
|
364 | *
|
365 | * @param {String} substring
|
366 | */
|
367 | toInclude(substring: string): R;
|
368 |
|
369 | /**
|
370 | * Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times.
|
371 | *
|
372 | * @param {String} substring
|
373 | * @param {Number} times
|
374 | */
|
375 | toIncludeRepeated(substring: string, times: number): R;
|
376 |
|
377 | /**
|
378 | * Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings.
|
379 | *
|
380 | * @param {Array.<String>} substring
|
381 | */
|
382 | toIncludeMultiple(substring: readonly string[]): R;
|
383 |
|
384 | /**
|
385 | * Use `.toThrowWithMessage` when checking if a callback function throws an error of a given type with a given error message.
|
386 | *
|
387 | * @param {Function} type
|
388 | * @param {String | RegExp} message
|
389 | */
|
390 | toThrowWithMessage(type: (...args: any[]) => any, message: string | RegExp): R;
|
391 |
|
392 | /**
|
393 | * Use `.toBeEmptyObject` when checking if a value is an empty `Object`.
|
394 | */
|
395 | toBeEmptyObject(): R;
|
396 |
|
397 | /**
|
398 | * Use `.toBeSymbol` when checking if a value is a `Symbol`.
|
399 | */
|
400 | toBeSymbol(): R;
|
401 |
|
402 | /**
|
403 | * Use `.toBeBetween` when checking if a date occurs between `startDate` and `endDate`.
|
404 | * @param {Date} startDate
|
405 | * @param {Date} endDate
|
406 | */
|
407 | toBeBetween(startDate: Date, endDate: Date): R;
|
408 |
|
409 | /**
|
410 | * Use `.toBeBeforeOrEqualTo` when checking if a date equals to or occurs before `date`.
|
411 | * @param {Date} date
|
412 | */
|
413 | toBeBeforeOrEqualTo(date: Date): R;
|
414 |
|
415 | /**
|
416 | * Use `.toBeAfterOrEqualTo` when checking if a date equals to or occurs after `date`.
|
417 | * @param {Date} date
|
418 | */
|
419 | toBeAfterOrEqualTo(date: Date): R;
|
420 |
|
421 | /**
|
422 | * Use `.toEqualIgnoringWhitespace` when checking if a `String` is equal (===) to given `String` ignoring white-space.
|
423 | *
|
424 | * @param {String} string
|
425 | */
|
426 | toEqualIgnoringWhitespace(string: string): R;
|
427 | }
|
428 |
|
429 | declare namespace jest {
|
430 | // noinspection JSUnusedGlobalSymbols
|
431 | interface Matchers<R> {
|
432 | /**
|
433 | * Note: Currently unimplemented
|
434 | * Passing assertion
|
435 | *
|
436 | * @param {String} message
|
437 | */
|
438 | pass(message: string): R;
|
439 |
|
440 | /**
|
441 | * Note: Currently unimplemented
|
442 | * Failing assertion
|
443 | *
|
444 | * @param {String} message
|
445 | */
|
446 | fail(message: string): never;
|
447 |
|
448 | /**
|
449 | * Use .toBeEmpty when checking if a String '', Array [], Object {} or Iterable (i.e. Map, Set) is empty.
|
450 | */
|
451 | toBeEmpty(): R;
|
452 |
|
453 | /**
|
454 | * Use .toBeOneOf when checking if a value is a member of a given Array.
|
455 | * @param {Array.<*>} members
|
456 | */
|
457 | toBeOneOf<E = unknown>(members: readonly E[]): R;
|
458 |
|
459 | /**
|
460 | * Use `.toBeNil` when checking a value is `null` or `undefined`.
|
461 | */
|
462 | toBeNil(): R;
|
463 |
|
464 | /**
|
465 | * Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`.
|
466 | * @param {Function} predicate
|
467 | */
|
468 | toSatisfy<E = any>(predicate: (x: E) => boolean): R;
|
469 |
|
470 | /**
|
471 | * Use `.toBeArray` when checking if a value is an `Array`.
|
472 | */
|
473 | toBeArray(): R;
|
474 |
|
475 | /**
|
476 | * Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x.
|
477 | * @param {Number} x
|
478 | */
|
479 | toBeArrayOfSize(x: number): R;
|
480 |
|
481 | /**
|
482 | * Use `.toBeAfter` when checking if a date occurs after `date`.
|
483 | * @param {Date} date
|
484 | */
|
485 | toBeAfter(date: Date): R;
|
486 |
|
487 | /**
|
488 | * Use `.toBeBefore` when checking if a date occurs before `date`.
|
489 | * @param {Date} date
|
490 | */
|
491 | toBeBefore(date: Date): R;
|
492 |
|
493 | /**
|
494 | * Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set.
|
495 | * @param {Array.<*>} members
|
496 | */
|
497 | toIncludeAllMembers<E = unknown>(members: readonly E[]): R;
|
498 |
|
499 | /**
|
500 | * Use `.toIncludeAllPartialMembers` when checking if an `Array` contains all of the same partial members of a given set.
|
501 | * @param {Array.<*>} members
|
502 | */
|
503 | toIncludeAllPartialMembers<E = unknown>(members: readonly E[]): R;
|
504 |
|
505 | /**
|
506 | * Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set.
|
507 | * @param {Array.<*>} members
|
508 | */
|
509 | toIncludeAnyMembers<E = unknown>(members: readonly E[]): R;
|
510 |
|
511 | /**
|
512 | * Use `.toIncludeSameMembers` when checking if two arrays contain equal values, in any order.
|
513 | * @param {Array.<*>} members
|
514 | */
|
515 | toIncludeSameMembers<E = unknown>(members: readonly E[]): R;
|
516 |
|
517 | /**
|
518 | * Use `.toPartiallyContain` when checking if any array value matches the partial member.
|
519 | * @param {*} member
|
520 | */
|
521 | toPartiallyContain<E = unknown>(member: E): R;
|
522 |
|
523 | /**
|
524 | * Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array.
|
525 | * @param {Function} predicate
|
526 | */
|
527 | toSatisfyAll<E = any>(predicate: (x: E) => boolean): R;
|
528 |
|
529 | /**
|
530 | * Use `.toSatisfyAny` when you want to use a custom matcher by supplying a predicate function that returns `true` for any matching value in an array.
|
531 | * @param {Function} predicate
|
532 | */
|
533 | toSatisfyAny(predicate: (x: any) => boolean): R;
|
534 |
|
535 | /**
|
536 | * Use `.toBeBoolean` when checking if a value is a `Boolean`.
|
537 | */
|
538 | toBeBoolean(): R;
|
539 |
|
540 | /**
|
541 | * Use `.toBeTrue` when checking a value is equal (===) to `true`.
|
542 | */
|
543 | toBeTrue(): R;
|
544 |
|
545 | /**
|
546 | * Use `.toBeFalse` when checking a value is equal (===) to `false`.
|
547 | */
|
548 | toBeFalse(): R;
|
549 |
|
550 | /**
|
551 | * Use `.toBeDate` when checking if a value is a `Date`.
|
552 | */
|
553 | toBeDate(): R;
|
554 |
|
555 | /**
|
556 | * Use `.toBeValidDate` when checking if a value is a `valid Date`.
|
557 | */
|
558 | toBeValidDate(): R;
|
559 |
|
560 | /**
|
561 | * Use `.toBeFunction` when checking if a value is a `Function`.
|
562 | */
|
563 | toBeFunction(): R;
|
564 |
|
565 | /**
|
566 | * Use `.toBeDateString` when checking if a value is a valid date string.
|
567 | */
|
568 | toBeDateString(): R;
|
569 |
|
570 | /**
|
571 | * Use `.toBeHexadecimal` when checking if a value is a valid HTML hex color.
|
572 | */
|
573 | toBeHexadecimal(): R;
|
574 |
|
575 | /**
|
576 | * Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`.
|
577 | *
|
578 | * Note: Required Jest version >=23
|
579 | *
|
580 | * @param {Mock} mock
|
581 | * @param {boolean} [failIfNoSecondInvocation=true]
|
582 | */
|
583 | toHaveBeenCalledBefore(mock: jest.MockInstance<any, any[]>, failIfNoSecondInvocation?: boolean): R;
|
584 |
|
585 | /**
|
586 | * Use `.toHaveBeenCalledAfter` when checking if a `Mock` was called after another `Mock`.
|
587 | *
|
588 | * Note: Required Jest version >=23
|
589 | *
|
590 | * @param {Mock} mock
|
591 | * @param {boolean} [failIfNoFirstInvocation=true]
|
592 | */
|
593 | toHaveBeenCalledAfter(mock: jest.MockInstance<any, any[]>, failIfNoFirstInvocation?: boolean): R;
|
594 |
|
595 | /**
|
596 | * Use `.toHaveBeenCalledOnce` to check if a `Mock` was called exactly one time.
|
597 | */
|
598 | toHaveBeenCalledOnce(): R;
|
599 |
|
600 | /**
|
601 | * Use `.toHaveBeenCalledExactlyOnceWith` to check if a `Mock` was called exactly one time with the expected value.
|
602 | */
|
603 | toHaveBeenCalledExactlyOnceWith(...args: unknown[]): R;
|
604 |
|
605 | /**
|
606 | * Use `.toBeNumber` when checking if a value is a `Number`.
|
607 | */
|
608 | toBeNumber(): R;
|
609 |
|
610 | /**
|
611 | * Use `.toBeNaN` when checking a value is `NaN`.
|
612 | */
|
613 | toBeNaN(): R;
|
614 |
|
615 | /**
|
616 | * Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`.
|
617 | */
|
618 | toBeFinite(): R;
|
619 |
|
620 | /**
|
621 | * Use `.toBePositive` when checking if a value is a positive `Number`.
|
622 | */
|
623 | toBePositive(): R;
|
624 |
|
625 | /**
|
626 | * Use `.toBeNegative` when checking if a value is a negative `Number`.
|
627 | */
|
628 | toBeNegative(): R;
|
629 |
|
630 | /**
|
631 | * Use `.toBeEven` when checking if a value is an even `Number`.
|
632 | */
|
633 | toBeEven(): R;
|
634 |
|
635 | /**
|
636 | * Use `.toBeOdd` when checking if a value is an odd `Number`.
|
637 | */
|
638 | toBeOdd(): R;
|
639 |
|
640 | /**
|
641 | * Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive).
|
642 | *
|
643 | * @param {Number} start
|
644 | * @param {Number} end
|
645 | */
|
646 | toBeWithin(start: number, end: number): R;
|
647 |
|
648 | /**
|
649 | * Use `.toBeInRange` when checking if an array has elements in range min (inclusive) and max (inclusive).
|
650 | *
|
651 | * @param min
|
652 | * @param max
|
653 | */
|
654 | toBeInRange(min: number, max: number): R;
|
655 |
|
656 | /**
|
657 | * Use `.toBeInteger` when checking if a value is an integer.
|
658 | */
|
659 | toBeInteger(): R;
|
660 |
|
661 | /**
|
662 | * Use `.toBeObject` when checking if a value is an `Object`.
|
663 | */
|
664 | toBeObject(): R;
|
665 |
|
666 | /**
|
667 | * Use `.toContainKey` when checking if an object contains the provided key.
|
668 | *
|
669 | * @param {String} key
|
670 | */
|
671 | toContainKey<E = unknown>(key: keyof E | string): R;
|
672 |
|
673 | /**
|
674 | * Use `.toContainKeys` when checking if an object has all of the provided keys.
|
675 | *
|
676 | * @param {Array.<String>} keys
|
677 | */
|
678 | toContainKeys<E = unknown>(keys: readonly (keyof E | string)[]): R;
|
679 |
|
680 | /**
|
681 | * Use `.toContainAllKeys` when checking if an object only contains all of the provided keys.
|
682 | *
|
683 | * @param {Array.<String>} keys
|
684 | */
|
685 | toContainAllKeys<E = unknown>(keys: readonly (keyof E | string)[]): R;
|
686 |
|
687 | /**
|
688 | * Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys.
|
689 | *
|
690 | * @param {Array.<String>} keys
|
691 | */
|
692 | toContainAnyKeys<E = unknown>(keys: readonly (keyof E | string)[]): R;
|
693 |
|
694 | /**
|
695 | * Use `.toContainValue` when checking if an object contains the provided value.
|
696 | *
|
697 | * @param {*} value
|
698 | */
|
699 | toContainValue<E = unknown>(value: E): R;
|
700 |
|
701 | /**
|
702 | * Use `.toContainValues` when checking if an object contains all of the provided values.
|
703 | *
|
704 | * @param {Array.<*>} values
|
705 | */
|
706 | toContainValues<E = unknown>(values: readonly E[]): R;
|
707 |
|
708 | /**
|
709 | * Use `.toContainAllValues` when checking if an object only contains all of the provided values.
|
710 | *
|
711 | * @param {Array.<*>} values
|
712 | */
|
713 | toContainAllValues<E = unknown>(values: readonly E[]): R;
|
714 |
|
715 | /**
|
716 | * Use `.toContainAnyValues` when checking if an object contains at least one of the provided values.
|
717 | *
|
718 | * @param {Array.<*>} values
|
719 | */
|
720 | toContainAnyValues<E = unknown>(values: readonly E[]): R;
|
721 |
|
722 | /**
|
723 | * Use `.toContainEntry` when checking if an object contains the provided entry.
|
724 | *
|
725 | * @param {Array.<String, String>} entry
|
726 | */
|
727 | toContainEntry<E = unknown>(entry: readonly [keyof E, E[keyof E]]): R;
|
728 |
|
729 | /**
|
730 | * Use `.toContainEntries` when checking if an object contains all of the provided entries.
|
731 | *
|
732 | * @param {Array.<Array.<keyof E, E[keyof E]>>} entries
|
733 | */
|
734 | toContainEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): R;
|
735 |
|
736 | /**
|
737 | * Use `.toContainAllEntries` when checking if an object only contains all of the provided entries.
|
738 | *
|
739 | * @param {Array.<Array.<keyof E, E[keyof E]>>} entries
|
740 | */
|
741 | toContainAllEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): R;
|
742 |
|
743 | /**
|
744 | * Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries.
|
745 | *
|
746 | * @param {Array.<Array.<keyof E, E[keyof E]>>} entries
|
747 | */
|
748 | toContainAnyEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): R;
|
749 |
|
750 | /**
|
751 | * Use `.toBeExtensible` when checking if an object is extensible.
|
752 | */
|
753 | toBeExtensible(): R;
|
754 |
|
755 | /**
|
756 | * Use `.toBeFrozen` when checking if an object is frozen.
|
757 | */
|
758 | toBeFrozen(): R;
|
759 |
|
760 | /**
|
761 | * Use `.toBeSealed` when checking if an object is sealed.
|
762 | */
|
763 | toBeSealed(): R;
|
764 |
|
765 | /**
|
766 | * Use `.toResolve` when checking if a promise resolves.
|
767 | */
|
768 | toResolve(): Promise<R>;
|
769 |
|
770 | /**
|
771 | * Use `.toReject` when checking if a promise rejects.
|
772 | */
|
773 | toReject(): Promise<R>;
|
774 |
|
775 | /**
|
776 | * Use `.toBeString` when checking if a value is a `String`.
|
777 | */
|
778 | toBeString(): R;
|
779 |
|
780 | /**
|
781 | * Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings.
|
782 | *
|
783 | * @param {String} string
|
784 | */
|
785 | toEqualCaseInsensitive(string: string): R;
|
786 |
|
787 | /**
|
788 | * Use `.toStartWith` when checking if a `String` starts with a given `String` prefix.
|
789 | *
|
790 | * @param {String} prefix
|
791 | */
|
792 | toStartWith(prefix: string): R;
|
793 |
|
794 | /**
|
795 | * Use `.toEndWith` when checking if a `String` ends with a given `String` suffix.
|
796 | *
|
797 | * @param {String} suffix
|
798 | */
|
799 | toEndWith(suffix: string): R;
|
800 |
|
801 | /**
|
802 | * Use `.toInclude` when checking if a `String` includes the given `String` substring.
|
803 | *
|
804 | * @param {String} substring
|
805 | */
|
806 | toInclude(substring: string): R;
|
807 |
|
808 | /**
|
809 | * Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times.
|
810 | *
|
811 | * @param {String} substring
|
812 | * @param {Number} times
|
813 | */
|
814 | toIncludeRepeated(substring: string, times: number): R;
|
815 |
|
816 | /**
|
817 | * Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings.
|
818 | *
|
819 | * @param {Array.<String>} substring
|
820 | */
|
821 | toIncludeMultiple(substring: readonly string[]): R;
|
822 |
|
823 | /**
|
824 | * Use `.toThrowWithMessage` when checking if a callback function throws an error of a given type with a given error message.
|
825 | *
|
826 | * @param {Function} type
|
827 | * @param {String | RegExp} message
|
828 | */
|
829 | toThrowWithMessage(
|
830 | type:
|
831 | | (new (...args: any[]) => { message: string })
|
832 | | (abstract new (...args: any[]) => { message: string })
|
833 | | ((...args: any[]) => { message: string }),
|
834 | message: string | RegExp,
|
835 | ): R;
|
836 |
|
837 | /**
|
838 | * Use `.toBeEmptyObject` when checking if a value is an empty `Object`.
|
839 | */
|
840 | toBeEmptyObject(): R;
|
841 |
|
842 | /**
|
843 | * Use `.toBeSymbol` when checking if a value is a `Symbol`.
|
844 | */
|
845 | toBeSymbol(): R;
|
846 |
|
847 | /**
|
848 | * Use `.toBeBetween` when checking if a date occurs between `startDate` and `endDate`.
|
849 | * @param {Date} startDate
|
850 | * @param {Date} endDate
|
851 | */
|
852 | toBeBetween(startDate: Date, endDate: Date): R;
|
853 |
|
854 | /**
|
855 | * Use `.toBeBeforeOrEqualTo` when checking if a date equals to or occurs before `date`.
|
856 | * @param {Date} date
|
857 | */
|
858 | toBeBeforeOrEqualTo(date: Date): R;
|
859 |
|
860 | /**
|
861 | * Use `.toBeAfterOrEqualTo` when checking if a date equals to or occurs after `date`.
|
862 | * @param {Date} date
|
863 | */
|
864 | toBeAfterOrEqualTo(date: Date): R;
|
865 |
|
866 | /**
|
867 | * Use `.toEqualIgnoringWhitespace` when checking if a `String` is equal (===) to given `String` ignoring white-space.
|
868 | *
|
869 | * @param {String} string
|
870 | */
|
871 | toEqualIgnoringWhitespace(string: string): R;
|
872 | }
|
873 |
|
874 | // noinspection JSUnusedGlobalSymbols
|
875 | // eslint-disable-next-line @typescript-eslint/no-empty-interface
|
876 | interface Expect extends CustomMatchers<any> {}
|
877 |
|
878 | // noinspection JSUnusedGlobalSymbols
|
879 | // eslint-disable-next-line @typescript-eslint/no-empty-interface
|
880 | interface InverseAsymmetricMatchers extends Expect {}
|
881 | }
|
882 |
|
883 | declare module 'jest-extended' {
|
884 | const matchers: CustomMatchers<any>;
|
885 | export = matchers;
|
886 | }
|
887 |
|
\ | No newline at end of file |