import { act } from 'react-dom/test-utils' ; import { registerTestBed , TestBed , AsyncTestBedConfig } from '@kbn/test/jest' ; import { EsDeprecationLogs } from '../../../public/application/components/es_deprecation_logs' ; import { WithAppDependencies } from '../helpers' ; const testBedConfig = { memoryRouter : { initialEntries : [ '/es_deprecation_logs' ] , componentRoutePath : '/es_deprecation_logs' , } , doMountAsync : true , } ; export type EsDeprecationLogsTestBed = TestBed & { actions : ReturnType < typeof createActions > ; } ; const createActions = ( testBed ) => { /**
     * User Actions
     */ const clickDeprecationToggle = async ( ) => { const { find , component } = testBed ; await act ( async ( ) => { find ( 'deprecationLoggingToggle' ) . simulate ( 'click' ) ; } ) ; component . update ( ) ; } ; const clickRetryButton = async ( ) => { const { find , component } = testBed ; await act ( async ( ) => { find ( 'retryButton' ) . simulate ( 'click' ) ; } ) ; component . update ( ) ; } ; const clickResetButton = async ( ) => { const { find , component } = testBed ; await act ( async ( ) => { find ( 'resetLastStoredDate' ) . simulate ( 'click' ) ; } ) ; component . update ( ) ; } ; return { clickDeprecationToggle , clickRetryButton , clickResetButton , } ; } ; export const setupESDeprecationLogsPage = async ( overrides ? ) : Promise < EsDeprecationLogsTestBed > => { const initTestBed = registerTestBed ( WithAppDependencies ( EsDeprecationLogs , overrides ) , testBedConfig ) ; const testBed = await initTestBed ( ) ; return { ... testBed , actions : createActions ( testBed ) , } ; } ;