import { BfetchServerSetup , BfetchServerStart } from '.' ; import { plugin as pluginInitializer } from '.' ; import { coreMock } from '../../../core/server/mocks' ; export type Setup = jest . Mocked < BfetchServerSetup > ; export type Start = jest . Mocked < BfetchServerStart > ; const createSetupContract = ( ) : Setup => { const setupContract = { addBatchProcessingRoute : jest . fn ( ) , addStreamingResponseRoute : jest . fn ( ) , } ; return setupContract ; } ; const createStartContract = ( ) : Start => { const startContract = { } ; return startContract ; } ; const createPlugin = async ( ) => { const pluginInitializerContext = coreMock . createPluginInitializerContext ( ) ; const coreSetup = coreMock . createSetup ( ) ; const coreStart = coreMock . createStart ( ) ; const plugin = pluginInitializer ( pluginInitializerContext ) ; const setup = await plugin . setup ( coreSetup , { } ) ; return { pluginInitializerContext , coreSetup , coreStart , plugin , setup , doStart : async ( ) => await plugin . start ( coreStart , { } ) , } ; } ; export const bfetchPluginMock = { createSetupContract , createStartContract , createPlugin , } ;