import { act } from 'react-dom/test-utils' ; import { TestBed } from '@kbn/test/jest' ; const jsonSelector = 'policyRequestJson' ; export const createRequestFlyoutActions = ( testBed ) => { const { find , component , exists } = testBed ; const openRequestFlyout = async ( ) => { await act ( async ( ) => { find ( 'requestButton' ) . simulate ( 'click' ) ; } ) ; component . update ( ) ; } ; const closeRequestFlyout = async ( ) => { await act ( async ( ) => { find ( 'policyRequestClose' ) . simulate ( 'click' ) ; } ) ; component . update ( ) ; } ; return { openRequestFlyout , closeRequestFlyout , hasRequestJson : ( ) => exists ( jsonSelector ) , getRequestJson : ( ) => find ( jsonSelector ) . text ( ) , hasInvalidPolicyAlert : ( ) => exists ( 'policyRequestInvalidAlert' ) , } ; } ;