Skip to content

Commit 73d0c27

Browse files
committed
refactor(tests): extract query function into a variable for clarity in useQuery tests
1 parent 91888a4 commit 73d0c27

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/vue-query/src/__tests__/useQuery.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@ vi.mock('../useBaseQuery')
1717

1818
describe('useQuery', () => {
1919
test('should properly execute query', () => {
20+
const queryFn = () => sleep(0).then(() => 'Some data')
21+
2022
useQuery({
2123
queryKey: ['key0'],
22-
queryFn: () => sleep(0).then(() => 'Some data'),
24+
queryFn,
2325
staleTime: 1000,
2426
})
2527

2628
expect(useBaseQuery).toBeCalledWith(
2729
QueryObserver,
2830
{
2931
queryKey: ['key0'],
30-
queryFn: () => sleep(0).then(() => 'Some data'),
32+
queryFn,
3133
staleTime: 1000,
3234
},
3335
undefined,

0 commit comments

Comments
 (0)