Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vraja-pro authored and pls78 committed Nov 20, 2024
1 parent 57fb392 commit 531cb2e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/js/tests/components/SEMrushCountrySelector.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,30 @@ describe( "SEMrushCountrySelector", () => {

expect( onClickMock ).toHaveBeenCalled();
} );

it( "successfully calls the associated setCountry function when a country is selected", () => {
const onChangeMock = jest.fn();

render( <SEMrushCountrySelector
setCountry={ onChangeMock }
newRequest={ noop }
setNoResultsFoundnewRequest={ noop }
setRequestSucceeded={ noop }
setRequestLimitReached={ noop }
setRequestFailed={ noop }
setNoResultsFound={ noop }
userLocale="en"
isRtl={ false }
/> );

const select = screen.getByRole( "combobox" );

expect( select ).toBeInTheDocument();

fireEvent.click( select );
const options = screen.getAllByRole( "option" );
fireEvent.click( options[ 3 ] );

expect( onChangeMock ).toHaveBeenCalled();
} );
} );

0 comments on commit 531cb2e

Please sign in to comment.