import { ContextService } from '../../context' ; import { createHttpServer , createCoreContext } from '../../http/test_utils' ; import { coreMock } from '../../mocks' ; import { SavedObjectsType } from '../types' ; const defaultCoreId = Symbol ( 'core' ) ; export const setupServer = async ( coreId = defaultCoreId ) => { const coreContext = createCoreContext ( { coreId } ) ; const contextService = new ContextService ( coreContext ) ; const server = createHttpServer ( coreContext ) ; const httpSetup = await server . setup ( { context : contextService . setup ( { pluginDependencies : new Map ( ) } ) , } ) ; const handlerContext = coreMock . createRequestHandlerContext ( ) ; httpSetup . registerRouteHandlerContext ( coreId , 'core' , async ( ctx , req , res ) => { return handlerContext ; } ) ; return { server , httpSetup , handlerContext , } ; } ; export const createExportableType = ( name ) : SavedObjectsType => { return { name , hidden : false , namespaceType : 'single' , mappings : { properties : { } , } , management : { importableAndExportable : true , } , } ; } ;