@@ -22,10 +22,22 @@ test('deprecate', () => {
22
22
} )
23
23
24
24
describe ( 'checkHtmlElement' , ( ) => {
25
+ let assertionContext
26
+ beforeAll ( ( ) => {
27
+ expect . extend ( {
28
+ fakeMatcher ( ) {
29
+ assertionContext = this
30
+
31
+ return { pass : true }
32
+ } ,
33
+ } )
34
+
35
+ expect ( true ) . fakeMatcher ( true )
36
+ } )
25
37
it ( 'does not throw an error for correct html element' , ( ) => {
26
38
expect ( ( ) => {
27
39
const element = document . createElement ( 'p' )
28
- checkHtmlElement ( element , ( ) => { } , { } )
40
+ checkHtmlElement ( element , ( ) => { } , assertionContext )
29
41
} ) . not . toThrow ( )
30
42
} )
31
43
@@ -35,25 +47,25 @@ describe('checkHtmlElement', () => {
35
47
'http://www.w3.org/2000/svg' ,
36
48
'rect' ,
37
49
)
38
- checkHtmlElement ( element , ( ) => { } , { } )
50
+ checkHtmlElement ( element , ( ) => { } , assertionContext )
39
51
} ) . not . toThrow ( )
40
52
} )
41
53
42
54
it ( 'does not throw for body' , ( ) => {
43
55
expect ( ( ) => {
44
- checkHtmlElement ( document . body , ( ) => { } , { } )
56
+ checkHtmlElement ( document . body , ( ) => { } , assertionContext )
45
57
} ) . not . toThrow ( )
46
58
} )
47
59
48
60
it ( 'throws for undefined' , ( ) => {
49
61
expect ( ( ) => {
50
- checkHtmlElement ( undefined , ( ) => { } , { } )
62
+ checkHtmlElement ( undefined , ( ) => { } , assertionContext )
51
63
} ) . toThrow ( HtmlElementTypeError )
52
64
} )
53
65
54
66
it ( 'throws for document' , ( ) => {
55
67
expect ( ( ) => {
56
- checkHtmlElement ( document , ( ) => { } , { } )
68
+ checkHtmlElement ( document , ( ) => { } , assertionContext )
57
69
} ) . toThrow ( HtmlElementTypeError )
58
70
} )
59
71
@@ -62,7 +74,7 @@ describe('checkHtmlElement', () => {
62
74
checkHtmlElement (
63
75
( ) => { } ,
64
76
( ) => { } ,
65
- { } ,
77
+ assertionContext ,
66
78
)
67
79
} ) . toThrow ( HtmlElementTypeError )
68
80
} )
@@ -77,7 +89,7 @@ describe('checkHtmlElement', () => {
77
89
} ,
78
90
} ,
79
91
( ) => { } ,
80
- { } ,
92
+ assertionContext ,
81
93
)
82
94
} ) . toThrow ( HtmlElementTypeError )
83
95
} )
0 commit comments