@@ -25,7 +25,8 @@ describe('create-trpc-query-client', () => {
2525 describe ( 'createTrpcQueryClient' , ( ) => {
2626 it ( 'creates client with proxy that returns fetch and useQuery functions' , ( ) => {
2727 const client = createTrpcQueryClient ( {
28- url : 'http://localhost:3000/api/trpc'
28+ url : 'http://localhost:3000/api/trpc' ,
29+ useQuery : mockUseQuery
2930 } ) ;
3031
3132 expect ( typeof ( client as any ) . getUser . fetch ) . toBe ( 'function' ) ;
@@ -36,7 +37,8 @@ describe('create-trpc-query-client', () => {
3637
3738 it ( 'proxy returns undefined for non-string properties' , ( ) => {
3839 const client = createTrpcQueryClient ( {
39- url : 'http://localhost:3000/api/trpc'
40+ url : 'http://localhost:3000/api/trpc' ,
41+ useQuery : mockUseQuery
4042 } ) ;
4143
4244 expect ( ( client as any ) [ Symbol . iterator ] ) . toBeUndefined ( ) ;
@@ -53,7 +55,8 @@ describe('create-trpc-query-client', () => {
5355 mockFetch . mockResolvedValue ( mockResponse as any ) ;
5456
5557 const client = createTrpcQueryClient ( {
56- url : 'http://localhost:3000/api/trpc'
58+ url : 'http://localhost:3000/api/trpc' ,
59+ useQuery : mockUseQuery
5760 } ) ;
5861
5962 const result = await ( client as any ) . getUser . fetch ( { id : '123' } ) ;
@@ -72,7 +75,8 @@ describe('create-trpc-query-client', () => {
7275
7376 it ( 'useQuery function calls useQuery with correct parameters' , ( ) => {
7477 const client = createTrpcQueryClient ( {
75- url : 'http://localhost:3000/api/trpc'
78+ url : 'http://localhost:3000/api/trpc' ,
79+ useQuery : mockUseQuery
7680 } ) ;
7781
7882 const mockQueryResult = {
@@ -100,7 +104,8 @@ describe('create-trpc-query-client', () => {
100104
101105 it ( 'useQuery converts camelCase to kebab-case for queryKey' , ( ) => {
102106 const client = createTrpcQueryClient ( {
103- url : 'http://localhost:3000/api/trpc'
107+ url : 'http://localhost:3000/api/trpc' ,
108+ useQuery : mockUseQuery
104109 } ) ;
105110
106111 mockUseQuery . mockReturnValue ( { } ) ;
@@ -115,7 +120,8 @@ describe('create-trpc-query-client', () => {
115120
116121 it ( 'useQuery handles endpoint names with consecutive uppercase letters' , ( ) => {
117122 const client = createTrpcQueryClient ( {
118- url : 'http://localhost:3000/api/trpc'
123+ url : 'http://localhost:3000/api/trpc' ,
124+ useQuery : mockUseQuery
119125 } ) ;
120126
121127 mockUseQuery . mockReturnValue ( { } ) ;
@@ -130,7 +136,8 @@ describe('create-trpc-query-client', () => {
130136
131137 it ( 'useQuery works without additional options' , ( ) => {
132138 const client = createTrpcQueryClient ( {
133- url : 'http://localhost:3000/api/trpc'
139+ url : 'http://localhost:3000/api/trpc' ,
140+ useQuery : mockUseQuery
134141 } ) ;
135142
136143 mockUseQuery . mockReturnValue ( { } ) ;
@@ -152,6 +159,7 @@ describe('create-trpc-query-client', () => {
152159
153160 const client = createTrpcQueryClient ( {
154161 url : 'http://localhost:3000/api/trpc' ,
162+ useQuery : mockUseQuery ,
155163 headers : {
156164 'Authorization' : 'Bearer token123'
157165 }
@@ -184,6 +192,7 @@ describe('create-trpc-query-client', () => {
184192
185193 const client = createTrpcQueryClient ( {
186194 url : 'http://localhost:3000/api/trpc' ,
195+ useQuery : mockUseQuery ,
187196 headers : headersFn
188197 } ) ;
189198
@@ -212,7 +221,8 @@ describe('create-trpc-query-client', () => {
212221 } ) ;
213222
214223 const client = createTrpcQueryClient < typeof testRouter > ( {
215- url : 'http://localhost:3000/api/trpc'
224+ url : 'http://localhost:3000/api/trpc' ,
225+ useQuery : mockUseQuery
216226 } ) ;
217227
218228 expect ( ( client as any ) . getUser . fetch ) . toBeDefined ( ) ;
@@ -233,7 +243,8 @@ describe('create-trpc-query-client', () => {
233243 mockFetch . mockResolvedValue ( mockResponse as any ) ;
234244
235245 const client = createTrpcQueryClient ( {
236- url : 'http://localhost:3000/api/trpc'
246+ url : 'http://localhost:3000/api/trpc' ,
247+ useQuery : mockUseQuery
237248 } ) ;
238249
239250 let capturedQueryFn : any ;
@@ -259,7 +270,8 @@ describe('create-trpc-query-client', () => {
259270
260271 it ( 'preserves all useQuery options while adding queryKey and queryFn' , ( ) => {
261272 const client = createTrpcQueryClient ( {
262- url : 'http://localhost:3000/api/trpc'
273+ url : 'http://localhost:3000/api/trpc' ,
274+ useQuery : mockUseQuery
263275 } ) ;
264276
265277 mockUseQuery . mockReturnValue ( { } ) ;
@@ -291,7 +303,8 @@ describe('create-trpc-query-client', () => {
291303 mockFetch . mockResolvedValue ( mockResponse as any ) ;
292304
293305 const client = createTrpcQueryClient ( {
294- url : 'http://localhost:3000/api/trpc'
306+ url : 'http://localhost:3000/api/trpc' ,
307+ useQuery : mockUseQuery
295308 } ) ;
296309
297310 let capturedQueryFn : any ;
0 commit comments