@@ -30,10 +30,10 @@ it('simple counter', async () => {
3030 </ StrictMode > ,
3131 )
3232
33- await screen . findByText ( 'count: 0' )
33+ expect ( await screen . findByText ( 'count: 0' ) ) . toBeInTheDocument ( )
3434
3535 fireEvent . click ( screen . getByText ( 'button' ) )
36- await screen . findByText ( 'count: 1' )
36+ expect ( await screen . findByText ( 'count: 1' ) ) . toBeInTheDocument ( )
3737 unmount ( )
3838} )
3939
@@ -72,20 +72,20 @@ it('no extra re-renders (commits)', async () => {
7272 )
7373
7474 await waitFor ( ( ) => {
75- screen . getByText ( 'count: 0 (1)' )
76- screen . getByText ( 'count2: 0 (1)' )
75+ expect ( screen . getByText ( 'count: 0 (1)' ) ) . toBeInTheDocument ( )
76+ expect ( screen . getByText ( 'count2: 0 (1)' ) ) . toBeInTheDocument ( )
7777 } )
7878
7979 fireEvent . click ( screen . getByText ( 'button' ) )
8080 await waitFor ( ( ) => {
81- screen . getByText ( 'count: 1 (2)' )
82- screen . getByText ( 'count2: 0 (1)' )
81+ expect ( screen . getByText ( 'count: 1 (2)' ) ) . toBeInTheDocument ( )
82+ expect ( screen . getByText ( 'count2: 0 (1)' ) ) . toBeInTheDocument ( )
8383 } )
8484
8585 fireEvent . click ( screen . getByText ( 'button2' ) )
8686 await waitFor ( ( ) => {
87- screen . getByText ( 'count: 1 (2)' )
88- screen . getByText ( 'count2: 1 (2)' )
87+ expect ( screen . getByText ( 'count: 1 (2)' ) ) . toBeInTheDocument ( )
88+ expect ( screen . getByText ( 'count2: 1 (2)' ) ) . toBeInTheDocument ( )
8989 } )
9090} )
9191
@@ -124,8 +124,8 @@ it('no extra re-renders (render func calls in non strict mode)', async () => {
124124 )
125125
126126 await waitFor ( ( ) => {
127- screen . getByText ( 'count: 0' )
128- screen . getByText ( 'count2: 0' )
127+ expect ( screen . getByText ( 'count: 0' ) ) . toBeInTheDocument ( )
128+ expect ( screen . getByText ( 'count2: 0' ) ) . toBeInTheDocument ( )
129129 } )
130130 expect ( renderFn ) . toBeCalledTimes ( 1 )
131131 expect ( renderFn ) . lastCalledWith ( 0 )
@@ -134,8 +134,8 @@ it('no extra re-renders (render func calls in non strict mode)', async () => {
134134
135135 fireEvent . click ( screen . getByText ( 'button' ) )
136136 await waitFor ( ( ) => {
137- screen . getByText ( 'count: 1' )
138- screen . getByText ( 'count2: 0' )
137+ expect ( screen . getByText ( 'count: 1' ) ) . toBeInTheDocument ( )
138+ expect ( screen . getByText ( 'count2: 0' ) ) . toBeInTheDocument ( )
139139 } )
140140 expect ( renderFn ) . toBeCalledTimes ( 2 )
141141 expect ( renderFn ) . lastCalledWith ( 1 )
@@ -144,8 +144,8 @@ it('no extra re-renders (render func calls in non strict mode)', async () => {
144144
145145 fireEvent . click ( screen . getByText ( 'button2' ) )
146146 await waitFor ( ( ) => {
147- screen . getByText ( 'count: 1' )
148- screen . getByText ( 'count2: 1' )
147+ expect ( screen . getByText ( 'count: 1' ) ) . toBeInTheDocument ( )
148+ expect ( screen . getByText ( 'count2: 1' ) ) . toBeInTheDocument ( )
149149 } )
150150 expect ( renderFn ) . toBeCalledTimes ( 2 )
151151 expect ( renderFn ) . lastCalledWith ( 1 )
@@ -154,8 +154,8 @@ it('no extra re-renders (render func calls in non strict mode)', async () => {
154154
155155 fireEvent . click ( screen . getByText ( 'button2' ) )
156156 await waitFor ( ( ) => {
157- screen . getByText ( 'count: 1' )
158- screen . getByText ( 'count2: 2' )
157+ expect ( screen . getByText ( 'count: 1' ) ) . toBeInTheDocument ( )
158+ expect ( screen . getByText ( 'count2: 2' ) ) . toBeInTheDocument ( )
159159 } )
160160 expect ( renderFn ) . toBeCalledTimes ( 2 )
161161 expect ( renderFn ) . lastCalledWith ( 1 )
@@ -164,8 +164,8 @@ it('no extra re-renders (render func calls in non strict mode)', async () => {
164164
165165 fireEvent . click ( screen . getByText ( 'button' ) )
166166 await waitFor ( ( ) => {
167- screen . getByText ( 'count: 2' )
168- screen . getByText ( 'count2: 2' )
167+ expect ( screen . getByText ( 'count: 2' ) ) . toBeInTheDocument ( )
168+ expect ( screen . getByText ( 'count2: 2' ) ) . toBeInTheDocument ( )
169169 } )
170170 expect ( renderFn ) . toBeCalledTimes ( 3 )
171171 expect ( renderFn ) . lastCalledWith ( 2 )
@@ -192,10 +192,10 @@ it('object in object', async () => {
192192 </ StrictMode > ,
193193 )
194194
195- await screen . findByText ( 'count: 0' )
195+ expect ( await screen . findByText ( 'count: 0' ) ) . toBeInTheDocument ( )
196196
197197 fireEvent . click ( screen . getByText ( 'button' ) )
198- await screen . findByText ( 'count: 1' )
198+ expect ( await screen . findByText ( 'count: 1' ) ) . toBeInTheDocument ( )
199199} )
200200
201201it ( 'array in object' , async ( ) => {
@@ -219,10 +219,10 @@ it('array in object', async () => {
219219 </ StrictMode > ,
220220 )
221221
222- await screen . findByText ( 'counts: 0,1,2' )
222+ expect ( await screen . findByText ( 'counts: 0,1,2' ) ) . toBeInTheDocument ( )
223223
224224 fireEvent . click ( screen . getByText ( 'button' ) )
225- await screen . findByText ( 'counts: 0,1,2,3' )
225+ expect ( await screen . findByText ( 'counts: 0,1,2,3' ) ) . toBeInTheDocument ( )
226226} )
227227
228228it ( 'array pop and splice' , async ( ) => {
@@ -245,13 +245,13 @@ it('array pop and splice', async () => {
245245 </ StrictMode > ,
246246 )
247247
248- await screen . findByText ( 'counts: 0,1,2' )
248+ expect ( await screen . findByText ( 'counts: 0,1,2' ) ) . toBeInTheDocument ( )
249249
250250 fireEvent . click ( screen . getByText ( 'button' ) )
251- await screen . findByText ( 'counts: 0,1' )
251+ expect ( await screen . findByText ( 'counts: 0,1' ) ) . toBeInTheDocument ( )
252252
253253 fireEvent . click ( screen . getByText ( 'button2' ) )
254- await screen . findByText ( 'counts: 0,10,11,1' )
254+ expect ( await screen . findByText ( 'counts: 0,10,11,1' ) ) . toBeInTheDocument ( )
255255} )
256256
257257it ( 'array length after direct assignment' , async ( ) => {
@@ -285,13 +285,13 @@ it('array length after direct assignment', async () => {
285285 </ StrictMode > ,
286286 )
287287
288- await screen . findByText ( 'counts: 0,1,2' )
288+ expect ( await screen . findByText ( 'counts: 0,1,2' ) ) . toBeInTheDocument ( )
289289
290290 fireEvent . click ( screen . getByText ( 'increment' ) )
291- await screen . findByText ( 'counts: 0,1,2,3' )
291+ expect ( await screen . findByText ( 'counts: 0,1,2,3' ) ) . toBeInTheDocument ( )
292292
293293 fireEvent . click ( screen . getByText ( 'jump' ) )
294- await screen . findByText ( 'counts: 0,1,2,3,,,,,,9' )
294+ expect ( await screen . findByText ( 'counts: 0,1,2,3,,,,,,9' ) ) . toBeInTheDocument ( )
295295} )
296296
297297it ( 'deleting property' , async ( ) => {
@@ -313,10 +313,10 @@ it('deleting property', async () => {
313313 </ StrictMode > ,
314314 )
315315
316- await screen . findByText ( 'count: 1' )
316+ expect ( await screen . findByText ( 'count: 1' ) ) . toBeInTheDocument ( )
317317
318318 fireEvent . click ( screen . getByText ( 'button' ) )
319- await screen . findByText ( 'count: none' )
319+ expect ( await screen . findByText ( 'count: none' ) ) . toBeInTheDocument ( )
320320} )
321321
322322it ( 'circular object' , async ( ) => {
@@ -340,10 +340,10 @@ it('circular object', async () => {
340340 </ StrictMode > ,
341341 )
342342
343- await screen . findByText ( 'count: 0' )
343+ expect ( await screen . findByText ( 'count: 0' ) ) . toBeInTheDocument ( )
344344
345345 fireEvent . click ( screen . getByText ( 'button' ) )
346- await screen . findByText ( 'count: 1' )
346+ expect ( await screen . findByText ( 'count: 1' ) ) . toBeInTheDocument ( )
347347} )
348348
349349it ( 'circular object with non-proxy object (#375)' , async ( ) => {
@@ -362,7 +362,7 @@ it('circular object with non-proxy object (#375)', async () => {
362362 </ StrictMode > ,
363363 )
364364
365- await screen . findByText ( 'count: 1' )
365+ expect ( await screen . findByText ( 'count: 1' ) ) . toBeInTheDocument ( )
366366} )
367367
368368it ( 'render from outside' , async ( ) => {
@@ -390,11 +390,11 @@ it('render from outside', async () => {
390390 </ StrictMode > ,
391391 )
392392
393- await screen . findByText ( 'anotherCount: 0' )
393+ expect ( await screen . findByText ( 'anotherCount: 0' ) ) . toBeInTheDocument ( )
394394
395395 fireEvent . click ( screen . getByText ( 'button' ) )
396396 fireEvent . click ( screen . getByText ( 'toggle' ) )
397- await screen . findByText ( 'count: 1' )
397+ expect ( await screen . findByText ( 'count: 1' ) ) . toBeInTheDocument ( )
398398} )
399399
400400it ( 'counter with sync option' , async ( ) => {
@@ -418,13 +418,13 @@ it('counter with sync option', async () => {
418418 </ > ,
419419 )
420420
421- await screen . findByText ( 'count: 0 (1)' )
421+ expect ( await screen . findByText ( 'count: 0 (1)' ) ) . toBeInTheDocument ( )
422422
423423 fireEvent . click ( screen . getByText ( 'button' ) )
424- await screen . findByText ( 'count: 1 (2)' )
424+ expect ( await screen . findByText ( 'count: 1 (2)' ) ) . toBeInTheDocument ( )
425425
426426 fireEvent . click ( screen . getByText ( 'button' ) )
427- await screen . findByText ( 'count: 2 (3)' )
427+ expect ( await screen . findByText ( 'count: 2 (3)' ) ) . toBeInTheDocument ( )
428428} )
429429
430430it ( 'support undefined property (#439)' , async ( ) => {
@@ -443,7 +443,7 @@ it('support undefined property (#439)', async () => {
443443 </ StrictMode > ,
444444 )
445445
446- await screen . findByText ( 'has prop: true' )
446+ expect ( await screen . findByText ( 'has prop: true' ) ) . toBeInTheDocument ( )
447447} )
448448
449449it ( 'sync snapshot between nested components (#460)' , async ( ) => {
@@ -481,14 +481,14 @@ it('sync snapshot between nested components (#460)', async () => {
481481 )
482482
483483 await waitFor ( ( ) => {
484- screen . getByText ( 'Parent: value1' )
485- screen . getByText ( 'Child: value1' )
484+ expect ( screen . getByText ( 'Parent: value1' ) ) . toBeInTheDocument ( )
485+ expect ( screen . getByText ( 'Child: value1' ) ) . toBeInTheDocument ( )
486486 } )
487487
488488 fireEvent . click ( screen . getByText ( 'button' ) )
489489 await waitFor ( ( ) => {
490- screen . getByText ( 'Parent: value2' )
491- screen . getByText ( 'Child: value2' )
490+ expect ( screen . getByText ( 'Parent: value2' ) ) . toBeInTheDocument ( )
491+ expect ( screen . getByText ( 'Child: value2' ) ) . toBeInTheDocument ( )
492492 } )
493493} )
494494
@@ -517,14 +517,14 @@ it('stable snapshot object (#985)', async () => {
517517
518518 render ( < TestComponent /> )
519519
520- await screen . findByText ( 'count: 0' )
520+ expect ( await screen . findByText ( 'count: 0' ) ) . toBeInTheDocument ( )
521521 expect ( effectCount ) . toBe ( 1 )
522522
523523 fireEvent . click ( screen . getByText ( 'button' ) )
524- await screen . findByText ( 'count: 1' )
524+ expect ( await screen . findByText ( 'count: 1' ) ) . toBeInTheDocument ( )
525525 expect ( effectCount ) . toBe ( 1 )
526526
527527 fireEvent . click ( screen . getByText ( 'button' ) )
528- await screen . findByText ( 'count: 2' )
528+ expect ( await screen . findByText ( 'count: 2' ) ) . toBeInTheDocument ( )
529529 expect ( effectCount ) . toBe ( 1 )
530530} )
0 commit comments