@@ -818,7 +818,7 @@ describe('useQuery', () => {
818
818
expect ( states [ 0 ] ) . toMatchObject ( { data : undefined , isFetching : true } )
819
819
expect ( states [ 1 ] ) . toMatchObject ( { data : 'test' , isFetching : false } )
820
820
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 )
822
822
} )
823
823
824
824
it ( 'should track properties and only re-render when a tracked property changes' , async ( ) => {
@@ -1039,13 +1039,13 @@ describe('useQuery', () => {
1039
1039
1040
1040
await waitFor ( ( ) => expect ( states . length ) . toBe ( 4 ) )
1041
1041
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 ]
1045
1045
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 ]
1049
1049
1050
1050
expect ( todos ) . toEqual ( result1 )
1051
1051
expect ( newTodos ) . toEqual ( result2 )
@@ -1465,7 +1465,7 @@ describe('useQuery', () => {
1465
1465
status : 'error' ,
1466
1466
isPreviousData : false ,
1467
1467
} )
1468
- expect ( states [ 7 ] . error ) . toHaveProperty ( 'message' , 'Error test' )
1468
+ expect ( states [ 7 ] ? .error ) . toHaveProperty ( 'message' , 'Error test' )
1469
1469
1470
1470
consoleMock . mockRestore ( )
1471
1471
} )
@@ -2304,7 +2304,7 @@ describe('useQuery', () => {
2304
2304
2305
2305
await sleep ( 20 )
2306
2306
2307
- expect ( states [ 1 ] . data ) . toEqual ( [ key , variables ] )
2307
+ expect ( states [ 1 ] ? .data ) . toEqual ( [ key , variables ] )
2308
2308
} )
2309
2309
2310
2310
it ( 'should not refetch query on focus when `enabled` is set to `false`' , async ( ) => {
0 commit comments