11import { Mutex } from 'async-mutex'
2- import axios , { AxiosRequestConfig , AxiosResponse , CustomParamsSerializer , ParamsSerializerOptions } from 'axios'
2+ import axios , { AxiosRequestConfig , AxiosResponse } from 'axios'
33import qs from 'qs'
44
55import { AuthData , Authenticator , BearerTokenAuthenticator , NoOpAuthenticator , RefreshData ,
@@ -150,18 +150,17 @@ describe('EndpointClient', () => {
150150 } ,
151151 data : undefined ,
152152 params : undefined ,
153- paramsSerializer : expect . any ( Object ) ,
153+ paramsSerializer : expect . any ( Function ) ,
154154 } )
155155 expect ( response . status ) . toBe ( 'ok' )
156156
157157 const stringifyMock = ( qs . stringify as jest . Mock < string , [ unknown ] > )
158158 . mockReturnValue ( 'stringified parameters' )
159159 // eslint-disable-next-line @typescript-eslint/no-explicit-any
160- const serialize = ( mockRequest . mock . calls [ 0 ] [ 0 ] . paramsSerializer as ParamsSerializerOptions )
161- ?. serialize as CustomParamsSerializer
160+ const paramsSerializer = mockRequest . mock . calls [ 0 ] [ 0 ] . paramsSerializer as ( params : any ) => string
162161
163- expect ( serialize ) . toBeDefined ( )
164- expect ( serialize ( { param : 'value' } ) ) . toBe ( 'stringified parameters' )
162+ expect ( paramsSerializer ) . toBeDefined ( )
163+ expect ( paramsSerializer ( { param : 'value' } ) ) . toBe ( 'stringified parameters' )
165164
166165 expect ( stringifyMock ) . toHaveBeenCalledTimes ( 1 )
167166 expect ( stringifyMock ) . toHaveBeenCalledWith ( { param : 'value' } , { indices : false } )
@@ -185,7 +184,7 @@ describe('EndpointClient', () => {
185184 } ,
186185 data : undefined ,
187186 params : undefined ,
188- paramsSerializer : expect . any ( Object ) ,
187+ paramsSerializer : expect . any ( Function ) ,
189188 } )
190189 expect ( response . status ) . toBe ( 'ok' )
191190 } )
@@ -204,7 +203,7 @@ describe('EndpointClient', () => {
204203 } ,
205204 data : undefined ,
206205 params : undefined ,
207- paramsSerializer : expect . any ( Object ) ,
206+ paramsSerializer : expect . any ( Function ) ,
208207 } )
209208 expect ( response . status ) . toBe ( 'ok' )
210209 } )
@@ -227,7 +226,7 @@ describe('EndpointClient', () => {
227226 } ,
228227 data : { name : 'Bob' } ,
229228 params : undefined ,
230- paramsSerializer : expect . any ( Object ) ,
229+ paramsSerializer : expect . any ( Function ) ,
231230 } )
232231 expect ( response . status ) . toBe ( 'ok' )
233232 } )
@@ -245,7 +244,7 @@ describe('EndpointClient', () => {
245244 } ,
246245 data : undefined ,
247246 params : undefined ,
248- paramsSerializer : expect . any ( Object ) ,
247+ paramsSerializer : expect . any ( Function ) ,
249248 } )
250249 expect ( response . status ) . toBe ( 'ok' )
251250 } )
@@ -268,7 +267,7 @@ describe('EndpointClient', () => {
268267 } ,
269268 data : undefined ,
270269 params : undefined ,
271- paramsSerializer : expect . any ( Object ) ,
270+ paramsSerializer : expect . any ( Function ) ,
272271 } )
273272 expect ( response . status ) . toBe ( 'ok' )
274273
@@ -321,7 +320,7 @@ describe('EndpointClient', () => {
321320 } ,
322321 data : undefined ,
323322 params : undefined ,
324- paramsSerializer : expect . any ( Object ) ,
323+ paramsSerializer : expect . any ( Function ) ,
325324 } )
326325 expect ( response . status ) . toBe ( 'ok' )
327326 } )
@@ -340,7 +339,7 @@ describe('EndpointClient', () => {
340339 params : {
341340 locationId : 'XXX' ,
342341 } ,
343- paramsSerializer : expect . any ( Object ) ,
342+ paramsSerializer : expect . any ( Function ) ,
344343 } )
345344 expect ( response . status ) . toBe ( 'ok' )
346345 } )
@@ -357,7 +356,7 @@ describe('EndpointClient', () => {
357356 } ,
358357 data : undefined ,
359358 params : undefined ,
360- paramsSerializer : expect . any ( Object ) ,
359+ paramsSerializer : expect . any ( Function ) ,
361360 } )
362361 expect ( response . status ) . toBe ( 'ok' )
363362 } )
@@ -374,7 +373,7 @@ describe('EndpointClient', () => {
374373 } ,
375374 data : undefined ,
376375 params : undefined ,
377- paramsSerializer : expect . any ( Object ) ,
376+ paramsSerializer : expect . any ( Function ) ,
378377 } )
379378 expect ( response . status ) . toBe ( 'ok' )
380379 } )
@@ -394,7 +393,7 @@ describe('EndpointClient', () => {
394393 name : 'Bill' ,
395394 } ,
396395 params : undefined ,
397- paramsSerializer : expect . any ( Object ) ,
396+ paramsSerializer : expect . any ( Function ) ,
398397 } )
399398 expect ( response . status ) . toBe ( 'ok' )
400399 } )
@@ -413,7 +412,7 @@ describe('EndpointClient', () => {
413412 name : 'Bill' ,
414413 } ,
415414 params : undefined ,
416- paramsSerializer : expect . any ( Object ) ,
415+ paramsSerializer : expect . any ( Function ) ,
417416 } )
418417 expect ( response . status ) . toBe ( 'ok' )
419418 } )
@@ -432,7 +431,7 @@ describe('EndpointClient', () => {
432431 name : 'Joe' ,
433432 } ,
434433 params : undefined ,
435- paramsSerializer : expect . any ( Object ) ,
434+ paramsSerializer : expect . any ( Function ) ,
436435 } )
437436 expect ( response . status ) . toBe ( 'ok' )
438437 } )
@@ -449,7 +448,7 @@ describe('EndpointClient', () => {
449448 } ,
450449 data : undefined ,
451450 params : undefined ,
452- paramsSerializer : expect . any ( Object ) ,
451+ paramsSerializer : expect . any ( Function ) ,
453452 } )
454453 expect ( response . status ) . toBe ( 'ok' )
455454 } )
0 commit comments