import { CoreSetup , CoreStart } from '../../../../src/core/public' ; import { coreMock } from '../../../../src/core/public/mocks' ; import { uiActionsPluginMock } from '../../../../src/plugins/ui_actions/public/mocks' ; import { embeddablePluginMock } from '../../../../src/plugins/embeddable/public/mocks' ; import { AdvancedUiActionsSetup , AdvancedUiActionsStart } from '.' ; import { plugin as pluginInitializer } from '.' ; import { licensingMock } from '../../licensing/public/mocks' ; import { StartDependencies } from './plugin' ; export type Setup = jest . Mocked < AdvancedUiActionsSetup > ; export type Start = jest . Mocked < AdvancedUiActionsStart > ; const createSetupContract = ( ) : Setup => { const setupContract = { ... uiActionsPluginMock . createSetupContract ( ) , registerDrilldown : jest . fn ( ) , } ; return setupContract ; } ; const createStartContract = ( ) : Start => { const startContract = { ... uiActionsPluginMock . createStartContract ( ) , getActionFactories : jest . fn ( ) , getActionFactory : jest . fn ( ) , hasActionFactory : jest . fn ( ) , DrilldownManager : jest . fn ( ) , telemetry : jest . fn ( ) , extract : jest . fn ( ) , inject : jest . fn ( ) , } ; return startContract ; } ; const createPlugin = ( coreSetup = coreMock . createSetup ( ) , coreStart = coreMock . createStart ( ) ) => { const pluginInitializerContext = coreMock . createPluginInitializerContext ( ) ; const uiActions = uiActionsPluginMock . createPlugin ( ) ; const embeddable = embeddablePluginMock . createInstance ( { uiActions : uiActions . setup , } ) ; const plugin = pluginInitializer ( pluginInitializerContext ) ; const setup = plugin . setup ( coreSetup , { uiActions : uiActions . setup , embeddable : embeddable . setup , licensing : licensingMock . createSetup ( ) , } ) ; return { pluginInitializerContext , coreSetup , coreStart , plugin , setup , doStart : ( anotherCoreStart = coreStart ) => { const uiActionsStart = uiActions . doStart ( ) ; const embeddableStart = embeddable . doStart ( { uiActions : uiActionsStart , } ) ; return plugin . start ( anotherCoreStart , { uiActions : uiActionsStart , embeddable : embeddableStart , licensing : licensingMock . createStart ( ) , } ) ; } , } ; } ; export const uiActionsEnhancedPluginMock = { createSetupContract , createStartContract , createPlugin , } ;