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', () => {
2634
2634
const state = useQuery (
2635
2635
key ,
2636
2636
async ( ) => {
2637
- await sleep ( 1 )
2637
+ await sleep ( 10 )
2638
2638
return count ++
2639
2639
} ,
2640
2640
{
@@ -2644,12 +2644,12 @@ describe('useQuery', () => {
2644
2644
}
2645
2645
)
2646
2646
states . push ( state )
2647
- return null
2647
+ return < div > data: { String ( state . data ) } </ div >
2648
2648
}
2649
2649
2650
- renderWithClient ( queryClient , < Page /> )
2650
+ const rendered = renderWithClient ( queryClient , < Page /> )
2651
2651
2652
- await sleep ( 10 )
2652
+ await rendered . findByText ( 'data: 0' )
2653
2653
2654
2654
expect ( states . length ) . toBe ( 2 )
2655
2655
expect ( states [ 0 ] ) . toMatchObject ( { data : undefined , isFetching : true } )
@@ -2659,7 +2659,7 @@ describe('useQuery', () => {
2659
2659
window . dispatchEvent ( new FocusEvent ( 'focus' ) )
2660
2660
} )
2661
2661
2662
- await sleep ( 10 )
2662
+ await rendered . findByText ( 'data: 1' )
2663
2663
2664
2664
// refetch should happen
2665
2665
expect ( states . length ) . toBe ( 4 )
@@ -2671,7 +2671,7 @@ describe('useQuery', () => {
2671
2671
window . dispatchEvent ( new FocusEvent ( 'focus' ) )
2672
2672
} )
2673
2673
2674
- await sleep ( 10 )
2674
+ await sleep ( 20 )
2675
2675
2676
2676
// no more refetch now
2677
2677
expect ( states . length ) . toBe ( 4 )
You can’t perform that action at this time.
0 commit comments