@@ -13,13 +13,13 @@ test('.toBeInTheDOM', () => {
13
13
// negative test cases wrapped in throwError assertions for coverage.
14
14
expect ( ( ) =>
15
15
expect ( queryByTestId ( 'count-value' ) ) . not . toBeInTheDOM ( ) ,
16
- ) . toThrowErrorMatchingSnapshot ( )
16
+ ) . toThrowError ( )
17
17
expect ( ( ) =>
18
18
expect ( queryByTestId ( 'count-value1' ) ) . toBeInTheDOM ( ) ,
19
- ) . toThrowErrorMatchingSnapshot ( )
19
+ ) . toThrowError ( )
20
20
expect ( ( ) =>
21
21
expect ( { thisIsNot : 'an html element' } ) . toBeInTheDOM ( ) ,
22
- ) . toThrowErrorMatchingSnapshot ( )
22
+ ) . toThrowError ( )
23
23
} )
24
24
25
25
test ( '.toHaveTextContent' , ( ) => {
@@ -30,14 +30,14 @@ test('.toHaveTextContent', () => {
30
30
expect ( queryByTestId ( 'count-value' ) ) . not . toHaveTextContent ( '21' )
31
31
expect ( ( ) =>
32
32
expect ( queryByTestId ( 'count-value2' ) ) . toHaveTextContent ( '2' ) ,
33
- ) . toThrowErrorMatchingSnapshot ( )
33
+ ) . toThrowError ( )
34
34
35
35
expect ( ( ) =>
36
36
expect ( queryByTestId ( 'count-value' ) ) . toHaveTextContent ( '3' ) ,
37
- ) . toThrowErrorMatchingSnapshot ( )
37
+ ) . toThrowError ( )
38
38
expect ( ( ) =>
39
39
expect ( queryByTestId ( 'count-value' ) ) . not . toHaveTextContent ( '2' ) ,
40
- ) . toThrowErrorMatchingSnapshot ( )
40
+ ) . toThrowError ( )
41
41
} )
42
42
43
43
test ( '.toHaveAttribute' , ( ) => {
@@ -55,22 +55,22 @@ test('.toHaveAttribute', () => {
55
55
56
56
expect ( ( ) =>
57
57
expect ( queryByTestId ( 'ok-button' ) ) . not . toHaveAttribute ( 'disabled' ) ,
58
- ) . toThrowErrorMatchingSnapshot ( )
58
+ ) . toThrowError ( )
59
59
expect ( ( ) =>
60
60
expect ( queryByTestId ( 'ok-button' ) ) . not . toHaveAttribute ( 'type' ) ,
61
- ) . toThrowErrorMatchingSnapshot ( )
61
+ ) . toThrowError ( )
62
62
expect ( ( ) =>
63
63
expect ( queryByTestId ( 'ok-button' ) ) . toHaveAttribute ( 'class' ) ,
64
- ) . toThrowErrorMatchingSnapshot ( )
64
+ ) . toThrowError ( )
65
65
expect ( ( ) =>
66
66
expect ( queryByTestId ( 'ok-button' ) ) . not . toHaveAttribute ( 'type' , 'submit' ) ,
67
- ) . toThrowErrorMatchingSnapshot ( )
67
+ ) . toThrowError ( )
68
68
expect ( ( ) =>
69
69
expect ( queryByTestId ( 'ok-button' ) ) . toHaveAttribute ( 'type' , 'button' ) ,
70
- ) . toThrowErrorMatchingSnapshot ( )
70
+ ) . toThrowError ( )
71
71
expect ( ( ) =>
72
72
expect ( { thisIsNot : 'an html element' } ) . not . toHaveAttribute ( ) ,
73
- ) . toThrowErrorMatchingSnapshot ( )
73
+ ) . toThrowError ( )
74
74
} )
75
75
76
76
test ( '.toHaveClass' , ( ) => {
@@ -95,25 +95,25 @@ test('.toHaveClass', () => {
95
95
96
96
expect ( ( ) =>
97
97
expect ( queryByTestId ( 'delete-button' ) ) . not . toHaveClass ( 'btn' ) ,
98
- ) . toThrowErrorMatchingSnapshot ( )
98
+ ) . toThrowError ( )
99
99
expect ( ( ) =>
100
100
expect ( queryByTestId ( 'delete-button' ) ) . not . toHaveClass ( 'btn-danger' ) ,
101
- ) . toThrowErrorMatchingSnapshot ( )
101
+ ) . toThrowError ( )
102
102
expect ( ( ) =>
103
103
expect ( queryByTestId ( 'delete-button' ) ) . not . toHaveClass ( 'extra' ) ,
104
- ) . toThrowErrorMatchingSnapshot ( )
104
+ ) . toThrowError ( )
105
105
expect ( ( ) =>
106
106
expect ( queryByTestId ( 'delete-button' ) ) . toHaveClass ( 'xtra' ) ,
107
- ) . toThrowErrorMatchingSnapshot ( )
107
+ ) . toThrowError ( )
108
108
expect ( ( ) =>
109
109
expect ( queryByTestId ( 'delete-button' ) ) . not . toHaveClass ( 'btn btn-danger' ) ,
110
- ) . toThrowErrorMatchingSnapshot ( )
110
+ ) . toThrowError ( )
111
111
expect ( ( ) =>
112
112
expect ( queryByTestId ( 'delete-button' ) ) . toHaveClass ( 'btn-link' ) ,
113
- ) . toThrowErrorMatchingSnapshot ( )
113
+ ) . toThrowError ( )
114
114
expect ( ( ) =>
115
115
expect ( queryByTestId ( 'cancel-button' ) ) . toHaveClass ( 'btn-danger' ) ,
116
- ) . toThrowErrorMatchingSnapshot ( )
116
+ ) . toThrowError ( )
117
117
} )
118
118
119
119
test ( '.toHaveStyle' , ( ) => {
@@ -155,20 +155,20 @@ test('.toHaveStyle', () => {
155
155
156
156
expect ( ( ) =>
157
157
expect ( container . querySelector ( '.label' ) ) . toHaveStyle ( 'font-weight: bold' ) ,
158
- ) . toThrowErrorMatchingSnapshot ( )
158
+ ) . toThrowError ( )
159
159
expect ( ( ) =>
160
160
expect ( container . querySelector ( '.label' ) ) . not . toHaveStyle ( 'color: white' ) ,
161
- ) . toThrowErrorMatchingSnapshot ( )
161
+ ) . toThrowError ( )
162
162
163
163
// Make sure the test fails if the css syntax is not valid
164
164
expect ( ( ) =>
165
165
expect ( container . querySelector ( '.label' ) ) . not . toHaveStyle (
166
166
'font-weight bold' ,
167
167
) ,
168
- ) . toThrowErrorMatchingSnapshot ( )
168
+ ) . toThrowError ( )
169
169
expect ( ( ) =>
170
170
expect ( container . querySelector ( '.label' ) ) . toHaveStyle ( 'color white' ) ,
171
- ) . toThrowErrorMatchingSnapshot ( )
171
+ ) . toThrowError ( )
172
172
173
173
document . body . removeChild ( style )
174
174
document . body . removeChild ( container )
@@ -200,8 +200,8 @@ test('.toBeVisible', () => {
200
200
201
201
expect ( ( ) =>
202
202
expect ( container . querySelector ( 'header' ) ) . not . toBeVisible ( ) ,
203
- ) . toThrowErrorMatchingSnapshot ( )
203
+ ) . toThrowError ( )
204
204
expect ( ( ) =>
205
205
expect ( container . querySelector ( 'p' ) ) . toBeVisible ( ) ,
206
- ) . toThrowErrorMatchingSnapshot ( )
206
+ ) . toThrowError ( )
207
207
} )
0 commit comments