mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
Jest matchers can accept many arguments
This commit is contained in:
Vendored
+2
-1
@@ -8,6 +8,7 @@
|
||||
// Allan Lukwago <https://github.com/epicallan>
|
||||
// Ika <https://github.com/ikatyang>
|
||||
// Waseem Dahman <https://github.com/wsmd>
|
||||
// Jamie Mason <https://github.com/JamieMason>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -240,7 +241,7 @@ declare namespace jest {
|
||||
}
|
||||
|
||||
interface ExpectExtendMap {
|
||||
[key: string]: (this: MatcherUtils, received: any, actual: any) => { message(): string, pass: boolean };
|
||||
[key: string]: (this: MatcherUtils, received: any, ...actual: any[]) => { message(): string, pass: boolean };
|
||||
}
|
||||
|
||||
interface SnapshotSerializerOptions {
|
||||
|
||||
@@ -259,6 +259,12 @@ describe('Extending extend', () => {
|
||||
() => `expected ${received} ${pass ? 'not ' : ''} to be ${actual}`;
|
||||
return { message, pass };
|
||||
},
|
||||
toBeVariadicMatcher(received: any, floor: number, ceiling: number) {
|
||||
const pass = received >= floor && received <= ceiling;
|
||||
const message =
|
||||
() => `expected ${received} ${pass ? 'not ' : ''} to be within range ${floor}-${ceiling}`;
|
||||
return { message, pass };
|
||||
},
|
||||
toBeTest(received: any, actual: any) {
|
||||
this.utils.ensureNoExpected(received);
|
||||
this.utils.ensureActualIsNumber(received);
|
||||
|
||||
Reference in New Issue
Block a user