@@ -4,10 +4,8 @@ import {
44 createClient ,
55 MiddlewareRequest ,
66 MiddlewareResponse ,
7- HttpErrorType ,
87 Process ,
98 Client ,
10- MethodType ,
119 ClientBuilder ,
1210} from '../../src'
1311import { createApiBuilderFromCtpClient } from '@commercetools/platform-sdk'
@@ -302,7 +300,7 @@ describe('process', () => {
302300 } )
303301
304302 return client
305- . process ( request , ( ) => Promise . resolve ( 'OK' ) )
303+ . process ( request , ( ) => Promise . resolve ( 'OK' as any ) )
306304 . then ( ( response ) => {
307305 expect ( response ) . toEqual ( [ 'OK' , 'OK' , 'OK' ] )
308306 } )
@@ -360,7 +358,7 @@ describe('process', () => {
360358 } )
361359
362360 return client
363- . process ( request , ( ) => Promise . resolve ( 'OK' ) , { total : 46 } )
361+ . process ( request , ( ) => Promise . resolve ( 'OK' as any ) , { total : 46 } )
364362 . then ( ( response ) => {
365363 expect ( response ) . toEqual ( [ 'OK' , 'OK' , 'OK' ] )
366364 } )
@@ -418,7 +416,7 @@ describe('process', () => {
418416 limit : 5 ,
419417 } ) } `,
420418 } ,
421- ( ) => Promise . resolve ( 'OK' )
419+ ( ) => Promise . resolve ( 'OK' ) as any
422420 )
423421 } )
424422
@@ -529,7 +527,7 @@ describe('process - exposed', () => {
529527 ] ,
530528 } )
531529
532- return Process ( request , ( ) => Promise . resolve ( 'OK' ) , { } ) . then (
530+ return Process ( request , ( ) => Promise . resolve ( 'OK' ) as any , { } ) . then (
533531 ( response ) => {
534532 expect ( response ) . toEqual ( [ 'OK' , 'OK' , 'OK' ] )
535533 }
@@ -582,11 +580,11 @@ describe('process - exposed', () => {
582580 ] ,
583581 } )
584582
585- return Process ( request , ( ) => Promise . resolve ( 'OK' ) , { total : 46 } ) . then (
586- ( response ) => {
587- expect ( response ) . toEqual ( [ 'OK' , 'OK' , 'OK' ] )
588- }
589- )
583+ return Process ( request , ( ) => Promise . resolve ( 'OK' ) as any , {
584+ total : 46 ,
585+ } ) . then ( ( response ) => {
586+ expect ( response ) . toEqual ( [ 'OK' , 'OK' , 'OK' ] )
587+ } )
590588 } )
591589
592590 test ( 'process and resolve pagination by preserving original query' , ( ) => {
@@ -635,7 +633,7 @@ describe('process - exposed', () => {
635633 limit : 5 ,
636634 } ) } `,
637635 } ,
638- ( ) => Promise . resolve ( 'OK' ) ,
636+ ( ) => Promise . resolve ( 'OK' ) as any ,
639637 { }
640638 )
641639 } )
@@ -688,7 +686,7 @@ describe('process - exposed', () => {
688686 } )
689687
690688 let fnCall = 0
691- const processRes = await Process (
689+ const processRes = await Process < { results : [ ] } > (
692690 {
693691 ...request ,
694692 uri : `${ request . uri } ?${ stringifyURLString ( {
@@ -698,11 +696,11 @@ describe('process - exposed', () => {
698696 } ) } `,
699697 } ,
700698 ( res ) => {
701- expect ( res . body . results ) . toEqual ( reqStubs [ fnCall ] . body . results )
699+ expect ( res . body ? .results ) . toEqual ( reqStubs [ fnCall ] . body . results )
702700 expect ( fnCall ) . toBeLessThan ( 2 ) // should not call fn if the last page is empty
703701
704702 fnCall += 1
705- return Promise . resolve ( `OK${ fnCall } ` )
703+ return Promise . resolve ( `OK${ fnCall } ` ) as any
706704 } ,
707705 {
708706 accumulate : true ,
@@ -713,7 +711,7 @@ describe('process - exposed', () => {
713711 expect ( fnCall ) . toBe ( 2 ) // fn was called two times
714712 } )
715713
716- test ( 'process and reject on rejection from user' , ( ) => {
714+ test ( 'process and reject on rejection from user' , async ( ) => {
717715 createClient ( {
718716 middlewares : [
719717 ( next ) =>
0 commit comments