@@ -41,7 +41,7 @@ describe('QueryClientProvider', () => {
4141 await vi . advanceTimersByTimeAsync ( 10 )
4242 expect ( rendered . getByText ( 'test' ) ) . toBeInTheDocument ( )
4343
44- expect ( queryCache . find ( { queryKey : key } ) ) . toBeDefined ( )
44+ expect ( queryCache . find ( { queryKey : key } ) ?. state . data ) . toBe ( 'test' )
4545 } )
4646
4747 it ( 'allows multiple caches to be partitioned' , async ( ) => {
@@ -94,10 +94,10 @@ describe('QueryClientProvider', () => {
9494 expect ( rendered . getByText ( 'test1' ) ) . toBeInTheDocument ( )
9595 expect ( rendered . getByText ( 'test2' ) ) . toBeInTheDocument ( )
9696
97- expect ( queryCache1 . find ( { queryKey : key1 } ) ) . toBeDefined ( )
98- expect ( queryCache1 . find ( { queryKey : key2 } ) ) . not . toBeDefined ( )
99- expect ( queryCache2 . find ( { queryKey : key1 } ) ) . not . toBeDefined ( )
100- expect ( queryCache2 . find ( { queryKey : key2 } ) ) . toBeDefined ( )
97+ expect ( queryCache1 . find ( { queryKey : key1 } ) ?. state . data ) . toBe ( 'test1' )
98+ expect ( queryCache1 . find ( { queryKey : key2 } ) ) . toBeUndefined ( )
99+ expect ( queryCache2 . find ( { queryKey : key1 } ) ) . toBeUndefined ( )
100+ expect ( queryCache2 . find ( { queryKey : key2 } ) ?. state . data ) . toBe ( 'test2' )
101101 } )
102102
103103 it ( "uses defaultOptions for queries when they don't provide their own config" , async ( ) => {
@@ -135,7 +135,6 @@ describe('QueryClientProvider', () => {
135135 await vi . advanceTimersByTimeAsync ( 10 )
136136 expect ( rendered . getByText ( 'test' ) ) . toBeInTheDocument ( )
137137
138- expect ( queryCache . find ( { queryKey : key } ) ) . toBeDefined ( )
139138 expect ( queryCache . find ( { queryKey : key } ) ?. options . gcTime ) . toBe ( Infinity )
140139 } )
141140
0 commit comments