import { registerTestBed , TestBedConfig } from '@kbn/test/jest' ; import React from 'react' ; import { RemoteClusterEdit } from '../../../public/application/sections' ; import { createRemoteClustersStore } from '../../../public/application/store' ; import { AppRouter , registerRouter } from '../../../public/application/services' ; import { createRemoteClustersActions } from '../helpers' ; import { AppContextProvider } from '../../../public/application/app_context' ; export const REMOTE_CLUSTER_EDIT_NAME = 'new-york' ; export const REMOTE_CLUSTER_EDIT = { name : REMOTE_CLUSTER_EDIT_NAME , seeds : [ 'localhost:9400' ] , skipUnavailable : true , } ; const ComponentWithContext = ( props ) => { const { isCloudEnabled , ... rest } = props ; return ( < AppContextProvider context = { { isCloudEnabled , cloudBaseUrl : 'test.com' } } > < RemoteClusterEdit { ... rest } / > < /AppContextProvider>); } ; const testBedConfig = { store : createRemoteClustersStore , memoryRouter : { onRouter : ( router ) => registerRouter ( router ) , initialEntries : [ `/${ REMOTE_CLUSTER_EDIT_NAME }` ] , componentRoutePath : '/:name' , } , } ; const initTestBed = ( isCloudEnabled ) => registerTestBed ( ComponentWithContext , testBedConfig ) ( { isCloudEnabled } ) ; export const setup = async ( isCloudEnabled = false ) => { const testBed = await initTestBed ( isCloudEnabled ) ; return { ... testBed , actions : { ... createRemoteClustersActions ( testBed ) , } , } ; } ;