11import { assertType , describe , expectTypeOf , it } from 'vitest'
2- import { queryKey } from '@tanstack/query-test-utils'
2+ import { createKey } from '@tanstack/query-test-utils'
33import { QueryClient , dataTagSymbol , skipToken } from '@tanstack/query-core'
44import { infiniteQueryOptions } from '../infinite-query-options'
55import { injectInfiniteQuery } from '../inject-infinite-query'
@@ -21,7 +21,7 @@ export const exportedInfiniteQueryOptions = infiniteQueryOptions({
2121
2222describe ( 'infiniteQueryOptions' , ( ) => {
2323 it ( 'should not allow excess properties' , ( ) => {
24- const key = queryKey ( )
24+ const key = createKey ( )
2525 assertType (
2626 infiniteQueryOptions ( {
2727 queryKey : key ,
@@ -35,7 +35,7 @@ describe('infiniteQueryOptions', () => {
3535 } )
3636
3737 it ( 'should infer types for callbacks' , ( ) => {
38- const key = queryKey ( )
38+ const key = createKey ( )
3939 infiniteQueryOptions ( {
4040 queryKey : key ,
4141 queryFn : ( ) => Promise . resolve ( 'data' ) ,
@@ -49,7 +49,7 @@ describe('infiniteQueryOptions', () => {
4949 } )
5050
5151 it ( 'should work when passed to useInfiniteQuery' , ( ) => {
52- const key = queryKey ( )
52+ const key = createKey ( )
5353 const options = infiniteQueryOptions ( {
5454 queryKey : key ,
5555 queryFn : ( ) => Promise . resolve ( 'string' ) ,
@@ -66,7 +66,7 @@ describe('infiniteQueryOptions', () => {
6666 } )
6767
6868 it ( 'should work when passed to fetchInfiniteQuery' , async ( ) => {
69- const key = queryKey ( )
69+ const key = createKey ( )
7070 const options = infiniteQueryOptions ( {
7171 queryKey : key ,
7272 queryFn : ( ) => Promise . resolve ( 'string' ) ,
@@ -135,7 +135,7 @@ describe('infiniteQueryOptions', () => {
135135 } )
136136
137137 it ( 'should tag the queryKey with the result type of the QueryFn' , ( ) => {
138- const key = queryKey ( )
138+ const key = createKey ( )
139139 const { queryKey : tagged } = infiniteQueryOptions ( {
140140 queryKey : key ,
141141 queryFn : ( ) => Promise . resolve ( 'string' ) ,
@@ -147,7 +147,7 @@ describe('infiniteQueryOptions', () => {
147147 } )
148148
149149 it ( 'should tag the queryKey even if no promise is returned' , ( ) => {
150- const key = queryKey ( )
150+ const key = createKey ( )
151151 const { queryKey : tagged } = infiniteQueryOptions ( {
152152 queryKey : key ,
153153 queryFn : ( ) => 'string' ,
@@ -159,7 +159,7 @@ describe('infiniteQueryOptions', () => {
159159 } )
160160
161161 it ( 'should tag the queryKey with the result type of the QueryFn if select is used' , ( ) => {
162- const key = queryKey ( )
162+ const key = createKey ( )
163163 const { queryKey : tagged } = infiniteQueryOptions ( {
164164 queryKey : key ,
165165 queryFn : ( ) => Promise . resolve ( 'string' ) ,
@@ -172,7 +172,7 @@ describe('infiniteQueryOptions', () => {
172172 } )
173173
174174 it ( 'should return the proper type when passed to getQueryData' , ( ) => {
175- const key = queryKey ( )
175+ const key = createKey ( )
176176 const { queryKey : tagged } = infiniteQueryOptions ( {
177177 queryKey : key ,
178178 queryFn : ( ) => Promise . resolve ( 'string' ) ,
@@ -189,7 +189,7 @@ describe('infiniteQueryOptions', () => {
189189 } )
190190
191191 it ( 'should properly type when passed to setQueryData' , ( ) => {
192- const key = queryKey ( )
192+ const key = createKey ( )
193193 const { queryKey : tagged } = infiniteQueryOptions ( {
194194 queryKey : key ,
195195 queryFn : ( ) => Promise . resolve ( 'string' ) ,
@@ -211,7 +211,7 @@ describe('infiniteQueryOptions', () => {
211211 } )
212212
213213 it ( 'should not be allowed to be passed to non-infinite query functions' , ( ) => {
214- const key = queryKey ( )
214+ const key = createKey ( )
215215 const queryClient = new QueryClient ( )
216216 const options = infiniteQueryOptions ( {
217217 queryKey : key ,
@@ -247,7 +247,7 @@ describe('infiniteQueryOptions', () => {
247247 } )
248248
249249 it ( 'should allow optional initialData function' , ( ) => {
250- const key = queryKey ( )
250+ const key = createKey ( )
251251 const initialData : { example : boolean } | undefined = { example : true }
252252 const queryOptions = infiniteQueryOptions ( {
253253 queryKey : key ,
@@ -266,7 +266,7 @@ describe('infiniteQueryOptions', () => {
266266 } )
267267
268268 it ( 'should allow optional initialData object' , ( ) => {
269- const key = queryKey ( )
269+ const key = createKey ( )
270270 const initialData : { example : boolean } | undefined = { example : true }
271271 const queryOptions = infiniteQueryOptions ( {
272272 queryKey : key ,
0 commit comments