9
9
import { equals , iterableEquality , subsetEquality } from '@jest/expect-utils' ;
10
10
import { alignedAnsiStyleSerializer } from '@jest/test-utils' ;
11
11
import * as matcherUtils from 'jest-matcher-utils' ;
12
- import importedExpect from '../' ;
12
+ import jestExpect from '../' ;
13
13
14
14
expect . addSnapshotSerializer ( alignedAnsiStyleSerializer ) ;
15
15
16
- importedExpect . extend ( {
16
+ jestExpect . extend ( {
17
17
toBeDivisibleBy ( actual : number , expected : number ) {
18
18
const pass = actual % expected === 0 ;
19
19
const message : ( ) => string = pass
@@ -52,6 +52,11 @@ importedExpect.extend({
52
52
} ) ;
53
53
54
54
declare module '../types' {
55
+ interface AsymmetricMatchers {
56
+ toBeDivisibleBy ( expected : number ) : void ;
57
+ toBeSymbol ( expected : symbol ) : void ;
58
+ toBeWithinRange ( floor : number , ceiling : number ) : void ;
59
+ }
55
60
interface Matchers < R > {
56
61
toBeDivisibleBy ( expected : number ) : R ;
57
62
toBeSymbol ( expected : symbol ) : R ;
@@ -64,17 +69,6 @@ declare module '../types' {
64
69
}
65
70
}
66
71
67
- const jestExpect = importedExpect as typeof importedExpect & {
68
- not : {
69
- toBeDivisibleBy ( expected : number ) : void ;
70
- toBeWithinRange ( floor : number , ceiling : number ) : void ;
71
- } ;
72
-
73
- toBeDivisibleBy ( expected : number ) : void ;
74
- toBeSymbol ( expected : symbol ) : void ;
75
- toBeWithinRange ( floor : number , ceiling : number ) : void ;
76
- } ;
77
-
78
72
it ( 'is available globally when matcher is unary' , ( ) => {
79
73
jestExpect ( 15 ) . toBeDivisibleBy ( 5 ) ;
80
74
jestExpect ( 15 ) . toBeDivisibleBy ( 3 ) ;
0 commit comments