import { IResponse , IHttpDeleteQueryCall , IHttpGetQueryCall , IHttpPatchQueryCall , IHttpPostQueryCall , IHttpPutQueryCall , IHttpQueryOptions , IHttpService , IHttpCancelRequestToken } from '@kentico/kontent-core' ; import { DeliveryClient } from '../../../../lib' ; class CustomHttpService implements IHttpService < undefined > { getAsync < TRawData > ( call , options ? ) { return this . resolveTestCall ( ) ; } postAsync < TRawData > ( call , options ? ) { return this . resolveTestCall ( ) ; } putAsync < TRawData > ( call , options ? ) { return this . resolveTestCall ( ) ; } patchAsync < TRawData > ( call , options ? ) { return this . resolveTestCall ( ) ; } deleteAsync < TRawData > ( call , options ? ) { return this . resolveTestCall ( ) ; } createCancelToken ( ) { return { cancel : ( ) => { } , token : undefined } ; } private resolveTestCall ( ) { const promise = new Promise < IResponse < any > > ( ( resolve , reject ) => { resolve ( { data : { } , headers : [ ] , rawResponse : { } , retryStrategy : { options : { } , retryAttempts : 3 } , status : 200 } ) ; } ) ; return promise ; } } describe ( 'Custom Http service' , ( ) => { const client = new DeliveryClient ( { projectId : 'xxx' , httpService : new CustomHttpService ( ) } ) ; it ( `Should use custom http service` , ( ) => { const httpService = client [ 'queryService' ] [ 'httpService' ] ; expect ( httpService ) . toEqual ( jasmine . any ( CustomHttpService ) ) ; } ) ; } ) ;