import React from 'react' ; import { shallow } from 'enzyme' ; jest . mock ( '../lib/get_default_query_language' , ( ) => ( { getDefaultQueryLanguage : ( ) => 'kuery' , } ) ) ; import { GaugePanelConfig } from './gauge' ; import { PanelConfigProps } from './types' ; describe ( 'GaugePanelConfig' , ( ) => { it ( 'call switch tab onChange={handleChange}' , ( ) => { const props = { fields : { } , model : { } , onChange : jest . fn ( ) , } as unknown as PanelConfigProps ; const wrapper = shallow ( < GaugePanelConfig { ... props } / > ) ; wrapper . find ( 'EuiTab' ) . first ( ) . simulate ( 'onClick' ) ; expect ( props . onChange ) . toBeCalled ( ) ; } ) ; it ( 'call onChange={handleChange}' , ( ) => { const props = { fields : { } , model : { } , onChange : jest . fn ( ) , } as unknown as PanelConfigProps ; const wrapper = shallow ( < GaugePanelConfig { ... props } / > ) ; wrapper . simulate ( 'onClick' ) ; expect ( props . onChange ) . toBeCalled ( ) ; } ) ; } ) ;