@@ -13,13 +13,13 @@ test('.toBeInTheDOM', () => {
1313 // negative test cases wrapped in throwError assertions for coverage.
1414 expect ( ( ) =>
1515 expect ( queryByTestId ( 'count-value' ) ) . not . toBeInTheDOM ( ) ,
16- ) . toThrowErrorMatchingSnapshot ( )
16+ ) . toThrowError ( )
1717 expect ( ( ) =>
1818 expect ( queryByTestId ( 'count-value1' ) ) . toBeInTheDOM ( ) ,
19- ) . toThrowErrorMatchingSnapshot ( )
19+ ) . toThrowError ( )
2020 expect ( ( ) =>
2121 expect ( { thisIsNot : 'an html element' } ) . toBeInTheDOM ( ) ,
22- ) . toThrowErrorMatchingSnapshot ( )
22+ ) . toThrowError ( )
2323} )
2424
2525test ( '.toHaveTextContent' , ( ) => {
@@ -30,14 +30,14 @@ test('.toHaveTextContent', () => {
3030 expect ( queryByTestId ( 'count-value' ) ) . not . toHaveTextContent ( '21' )
3131 expect ( ( ) =>
3232 expect ( queryByTestId ( 'count-value2' ) ) . toHaveTextContent ( '2' ) ,
33- ) . toThrowErrorMatchingSnapshot ( )
33+ ) . toThrowError ( )
3434
3535 expect ( ( ) =>
3636 expect ( queryByTestId ( 'count-value' ) ) . toHaveTextContent ( '3' ) ,
37- ) . toThrowErrorMatchingSnapshot ( )
37+ ) . toThrowError ( )
3838 expect ( ( ) =>
3939 expect ( queryByTestId ( 'count-value' ) ) . not . toHaveTextContent ( '2' ) ,
40- ) . toThrowErrorMatchingSnapshot ( )
40+ ) . toThrowError ( )
4141} )
4242
4343test ( '.toHaveAttribute' , ( ) => {
@@ -55,22 +55,22 @@ test('.toHaveAttribute', () => {
5555
5656 expect ( ( ) =>
5757 expect ( queryByTestId ( 'ok-button' ) ) . not . toHaveAttribute ( 'disabled' ) ,
58- ) . toThrowErrorMatchingSnapshot ( )
58+ ) . toThrowError ( )
5959 expect ( ( ) =>
6060 expect ( queryByTestId ( 'ok-button' ) ) . not . toHaveAttribute ( 'type' ) ,
61- ) . toThrowErrorMatchingSnapshot ( )
61+ ) . toThrowError ( )
6262 expect ( ( ) =>
6363 expect ( queryByTestId ( 'ok-button' ) ) . toHaveAttribute ( 'class' ) ,
64- ) . toThrowErrorMatchingSnapshot ( )
64+ ) . toThrowError ( )
6565 expect ( ( ) =>
6666 expect ( queryByTestId ( 'ok-button' ) ) . not . toHaveAttribute ( 'type' , 'submit' ) ,
67- ) . toThrowErrorMatchingSnapshot ( )
67+ ) . toThrowError ( )
6868 expect ( ( ) =>
6969 expect ( queryByTestId ( 'ok-button' ) ) . toHaveAttribute ( 'type' , 'button' ) ,
70- ) . toThrowErrorMatchingSnapshot ( )
70+ ) . toThrowError ( )
7171 expect ( ( ) =>
7272 expect ( { thisIsNot : 'an html element' } ) . not . toHaveAttribute ( ) ,
73- ) . toThrowErrorMatchingSnapshot ( )
73+ ) . toThrowError ( )
7474} )
7575
7676test ( '.toHaveClass' , ( ) => {
@@ -95,25 +95,25 @@ test('.toHaveClass', () => {
9595
9696 expect ( ( ) =>
9797 expect ( queryByTestId ( 'delete-button' ) ) . not . toHaveClass ( 'btn' ) ,
98- ) . toThrowErrorMatchingSnapshot ( )
98+ ) . toThrowError ( )
9999 expect ( ( ) =>
100100 expect ( queryByTestId ( 'delete-button' ) ) . not . toHaveClass ( 'btn-danger' ) ,
101- ) . toThrowErrorMatchingSnapshot ( )
101+ ) . toThrowError ( )
102102 expect ( ( ) =>
103103 expect ( queryByTestId ( 'delete-button' ) ) . not . toHaveClass ( 'extra' ) ,
104- ) . toThrowErrorMatchingSnapshot ( )
104+ ) . toThrowError ( )
105105 expect ( ( ) =>
106106 expect ( queryByTestId ( 'delete-button' ) ) . toHaveClass ( 'xtra' ) ,
107- ) . toThrowErrorMatchingSnapshot ( )
107+ ) . toThrowError ( )
108108 expect ( ( ) =>
109109 expect ( queryByTestId ( 'delete-button' ) ) . not . toHaveClass ( 'btn btn-danger' ) ,
110- ) . toThrowErrorMatchingSnapshot ( )
110+ ) . toThrowError ( )
111111 expect ( ( ) =>
112112 expect ( queryByTestId ( 'delete-button' ) ) . toHaveClass ( 'btn-link' ) ,
113- ) . toThrowErrorMatchingSnapshot ( )
113+ ) . toThrowError ( )
114114 expect ( ( ) =>
115115 expect ( queryByTestId ( 'cancel-button' ) ) . toHaveClass ( 'btn-danger' ) ,
116- ) . toThrowErrorMatchingSnapshot ( )
116+ ) . toThrowError ( )
117117} )
118118
119119test ( '.toHaveStyle' , ( ) => {
@@ -155,20 +155,20 @@ test('.toHaveStyle', () => {
155155
156156 expect ( ( ) =>
157157 expect ( container . querySelector ( '.label' ) ) . toHaveStyle ( 'font-weight: bold' ) ,
158- ) . toThrowErrorMatchingSnapshot ( )
158+ ) . toThrowError ( )
159159 expect ( ( ) =>
160160 expect ( container . querySelector ( '.label' ) ) . not . toHaveStyle ( 'color: white' ) ,
161- ) . toThrowErrorMatchingSnapshot ( )
161+ ) . toThrowError ( )
162162
163163 // Make sure the test fails if the css syntax is not valid
164164 expect ( ( ) =>
165165 expect ( container . querySelector ( '.label' ) ) . not . toHaveStyle (
166166 'font-weight bold' ,
167167 ) ,
168- ) . toThrowErrorMatchingSnapshot ( )
168+ ) . toThrowError ( )
169169 expect ( ( ) =>
170170 expect ( container . querySelector ( '.label' ) ) . toHaveStyle ( 'color white' ) ,
171- ) . toThrowErrorMatchingSnapshot ( )
171+ ) . toThrowError ( )
172172
173173 document . body . removeChild ( style )
174174 document . body . removeChild ( container )
@@ -200,8 +200,8 @@ test('.toBeVisible', () => {
200200
201201 expect ( ( ) =>
202202 expect ( container . querySelector ( 'header' ) ) . not . toBeVisible ( ) ,
203- ) . toThrowErrorMatchingSnapshot ( )
203+ ) . toThrowError ( )
204204 expect ( ( ) =>
205205 expect ( container . querySelector ( 'p' ) ) . toBeVisible ( ) ,
206- ) . toThrowErrorMatchingSnapshot ( )
206+ ) . toThrowError ( )
207207} )
0 commit comments