File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -305,18 +305,24 @@ describe('ReactQueryDevtools', () => {
305305 return 'query-1-result'
306306 } )
307307
308- const query2Result = useQuery ( [ 'query-2' ] , async ( ) => {
309- await sleep ( 90 )
310- return 'query-2-result'
311- } )
312-
313308 const query3Result = useQuery (
314309 [ 'query-3' ] ,
315310 async ( ) => {
316- await sleep ( 50 )
311+ await sleep ( 10 )
317312 return 'query-3-result'
318313 } ,
319- { staleTime : Infinity }
314+ { staleTime : Infinity , enabled : typeof query1Result . data === 'string' }
315+ )
316+
317+ const query2Result = useQuery (
318+ [ 'query-2' ] ,
319+ async ( ) => {
320+ await sleep ( 10 )
321+ return 'query-2-result'
322+ } ,
323+ {
324+ enabled : typeof query3Result . data === 'string' ,
325+ }
320326 )
321327
322328 return (
@@ -356,9 +362,7 @@ describe('ReactQueryDevtools', () => {
356362 expect ( queries [ 2 ] ?. textContent ) . toEqual ( query3Hash )
357363
358364 // Wait for the queries to be resolved
359- await waitFor ( ( ) => {
360- expect ( queryClient . isFetching ( ) ) . toBe ( 0 )
361- } )
365+ await screen . findByText ( / q u e r y - 1 - r e s u l t q u e r y - 2 - r e s u l t q u e r y - 3 - r e s u l t / i)
362366
363367 // When sorted by the last updated date the queries are sorted by the time
364368 // they were updated and since the query-2 takes longest time to complete
You can’t perform that action at this time.
0 commit comments