import { act } from 'react-dom/test-utils' ; import { registerTestBed , TestBed , AsyncTestBedConfig } from '@kbn/test/jest' ; import { Overview } from '../../../public/application/components/overview' ; import { WithAppDependencies } from '../helpers' ; const testBedConfig = { memoryRouter : { initialEntries : [ `/overview` ] , componentRoutePath : '/overview' , } , doMountAsync : true , } ; export type OverviewTestBed = TestBed & { actions : ReturnType < typeof createActions > ; } ; const createActions = ( testBed ) => { /**
     * User Actions
     */ const clickViewSystemIndicesState = async ( ) => { const { find , component } = testBed ; await act ( async ( ) => { find ( 'viewSystemIndicesStateButton' ) . simulate ( 'click' ) ; } ) ; component . update ( ) ; } ; const clickRetrySystemIndicesButton = async ( ) => { const { find , component } = testBed ; await act ( async ( ) => { find ( 'systemIndicesStatusRetryButton' ) . simulate ( 'click' ) ; } ) ; component . update ( ) ; } ; return { clickViewSystemIndicesState , clickRetrySystemIndicesButton , } ; } ; export const setupOverviewPage = async ( overrides ? ) : Promise < OverviewTestBed > => { const initTestBed = registerTestBed ( WithAppDependencies ( Overview , overrides ) , testBedConfig ) ; const testBed = await initTestBed ( ) ; return { ... testBed , actions : createActions ( testBed ) , } ; } ;