@@ -818,7 +818,7 @@ describe('useQuery', () => {
818818 expect ( states [ 0 ] ) . toMatchObject ( { data : undefined , isFetching : true } )
819819 expect ( states [ 1 ] ) . toMatchObject ( { data : 'test' , isFetching : false } )
820820 expect ( states [ 2 ] ) . toMatchObject ( { data : 'test' , isFetching : false } )
821- expect ( states [ 1 ] . dataUpdatedAt ) . not . toBe ( states [ 2 ] . dataUpdatedAt )
821+ expect ( states [ 1 ] ? .dataUpdatedAt ) . not . toBe ( states [ 2 ] ? .dataUpdatedAt )
822822 } )
823823
824824 it ( 'should track properties and only re-render when a tracked property changes' , async ( ) => {
@@ -1039,13 +1039,13 @@ describe('useQuery', () => {
10391039
10401040 await waitFor ( ( ) => expect ( states . length ) . toBe ( 4 ) )
10411041
1042- const todos = states [ 2 ] . data !
1043- const todo1 = todos [ 0 ]
1044- const todo2 = todos [ 1 ]
1042+ const todos = states [ 2 ] ? .data
1043+ const todo1 = todos ?. [ 0 ]
1044+ const todo2 = todos ?. [ 1 ]
10451045
1046- const newTodos = states [ 3 ] . data !
1047- const newTodo1 = newTodos [ 0 ]
1048- const newTodo2 = newTodos [ 1 ]
1046+ const newTodos = states [ 3 ] ? .data
1047+ const newTodo1 = newTodos ?. [ 0 ]
1048+ const newTodo2 = newTodos ?. [ 1 ]
10491049
10501050 expect ( todos ) . toEqual ( result1 )
10511051 expect ( newTodos ) . toEqual ( result2 )
@@ -1465,7 +1465,7 @@ describe('useQuery', () => {
14651465 status : 'error' ,
14661466 isPreviousData : false ,
14671467 } )
1468- expect ( states [ 7 ] . error ) . toHaveProperty ( 'message' , 'Error test' )
1468+ expect ( states [ 7 ] ? .error ) . toHaveProperty ( 'message' , 'Error test' )
14691469
14701470 consoleMock . mockRestore ( )
14711471 } )
@@ -2304,7 +2304,7 @@ describe('useQuery', () => {
23042304
23052305 await sleep ( 20 )
23062306
2307- expect ( states [ 1 ] . data ) . toEqual ( [ key , variables ] )
2307+ expect ( states [ 1 ] ? .data ) . toEqual ( [ key , variables ] )
23082308 } )
23092309
23102310 it ( 'should not refetch query on focus when `enabled` is set to `false`' , async ( ) => {
0 commit comments