import { httpServiceMock , httpServerMock } from '../../../../../src/core/server/mocks' ; import { getRequestBasePath } from './utils' ; describe ( 'getRequestBasePath' , ( ) => { let basePath ; let request ; beforeEach ( ( ) => { basePath = httpServiceMock . createBasePath ( ) ; request = httpServerMock . createKibanaRequest ( ) ; } ) ; it ( 'return a IBasePath prepending the request basePath' , ( ) => { basePath . get . mockReturnValue ( '/base-path/s/my-space' ) ; const requestBasePath = getRequestBasePath ( request , basePath ) ; const fullPath = requestBasePath . prepend ( '/app/dashboard/some-id' ) ; expect ( fullPath ) . toBe ( '/base-path/s/my-space/app/dashboard/some-id' ) ; expect ( basePath . get ) . toHaveBeenCalledTimes ( 1 ) ; expect ( basePath . get ) . toHaveBeenCalledWith ( request ) ; expect ( basePath . prepend ) . not . toHaveBeenCalled ( ) ; } ) ; } ) ; httpServiceMock . createBasePath ( ) ;