File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -2634,7 +2634,7 @@ describe('useQuery', () => {
26342634 const state = useQuery (
26352635 key ,
26362636 async ( ) => {
2637- await sleep ( 1 )
2637+ await sleep ( 10 )
26382638 return count ++
26392639 } ,
26402640 {
@@ -2644,12 +2644,12 @@ describe('useQuery', () => {
26442644 }
26452645 )
26462646 states . push ( state )
2647- return null
2647+ return < div > data: { String ( state . data ) } </ div >
26482648 }
26492649
2650- renderWithClient ( queryClient , < Page /> )
2650+ const rendered = renderWithClient ( queryClient , < Page /> )
26512651
2652- await sleep ( 10 )
2652+ await rendered . findByText ( 'data: 0' )
26532653
26542654 expect ( states . length ) . toBe ( 2 )
26552655 expect ( states [ 0 ] ) . toMatchObject ( { data : undefined , isFetching : true } )
@@ -2659,7 +2659,7 @@ describe('useQuery', () => {
26592659 window . dispatchEvent ( new FocusEvent ( 'focus' ) )
26602660 } )
26612661
2662- await sleep ( 10 )
2662+ await rendered . findByText ( 'data: 1' )
26632663
26642664 // refetch should happen
26652665 expect ( states . length ) . toBe ( 4 )
@@ -2671,7 +2671,7 @@ describe('useQuery', () => {
26712671 window . dispatchEvent ( new FocusEvent ( 'focus' ) )
26722672 } )
26732673
2674- await sleep ( 10 )
2674+ await sleep ( 20 )
26752675
26762676 // no more refetch now
26772677 expect ( states . length ) . toBe ( 4 )
You can’t perform that action at this time.
0 commit comments