import { HttpService } from '../public/http' ; import { fatalErrorsServiceMock } from '../public/fatal_errors/fatal_errors_service.mock' ; import { injectedMetadataServiceMock } from '../public/injected_metadata/injected_metadata_service.mock' ; export type SetupTap = ( injectedMetadata : ReturnType < typeof injectedMetadataServiceMock . createSetupContract > , fatalErrors : ReturnType < typeof fatalErrorsServiceMock . createSetupContract > ) => void ; const defaultTap = ( injectedMetadata ) => { injectedMetadata . getBasePath . mockReturnValue ( 'http://localhost/myBase' ) ; } ; export function setup ( tap = defaultTap ) { const injectedMetadata = injectedMetadataServiceMock . createSetupContract ( ) ; const fatalErrors = fatalErrorsServiceMock . createSetupContract ( ) ; tap ( injectedMetadata , fatalErrors ) ; const httpService = new HttpService ( ) ; const http = httpService . setup ( { fatalErrors , injectedMetadata } ) ; return { httpService , injectedMetadata , fatalErrors , http } ; }