diff --git a/tests/unit/components/Settings/Settings.test.js b/tests/unit/components/Settings/Settings.test.js index c4b03932d..00e8a57cf 100644 --- a/tests/unit/components/Settings/Settings.test.js +++ b/tests/unit/components/Settings/Settings.test.js @@ -26,6 +26,12 @@ jest.mock( "@react-navigation/native", ( ) => { const initialStoreState = useStore.getState( ); +const toggleAdvancedMode = async ( ) => { + const advancedRadioButton = await screen + .findByText( /Advanced/ ); + fireEvent.press( advancedRadioButton ); +}; + beforeAll( async ( ) => { useStore.setState( initialStoreState, true ); // userEvent recommends fake timers @@ -48,6 +54,7 @@ beforeEach( ( ) => { describe( "Settings", ( ) => { it( "should toggle the green observation button", async ( ) => { renderComponent( ); + await toggleAdvancedMode( ); const aiCameraRow = await screen.findByLabelText( "iNaturalist AI Camera" ); expect( aiCameraRow ).toHaveProp( "accessibilityState", expect.objectContaining( { checked: true @@ -73,6 +80,7 @@ describe( "Settings", ( ) => { it( "should toggle taxon names display", async ( ) => { renderComponent( ); + await toggleAdvancedMode( ); const sciNameFirst = await screen.findByLabelText( "Scientific Name (Common Name)" ); expect( sciNameFirst ).toHaveProp( "accessibilityState", expect.objectContaining( { checked: false @@ -110,6 +118,7 @@ describe( "Settings", ( ) => { it( "should not change state if taxon names toggled with no internet", async ( ) => { renderComponent( ); + await toggleAdvancedMode( ); const sciNameFirst = await screen.findByLabelText( "Scientific Name (Common Name)" ); expect( sciNameFirst ).toHaveProp( "accessibilityState", expect.objectContaining( { checked: false @@ -135,6 +144,7 @@ describe( "Settings", ( ) => { test( "should change language immediately via language picker via online results", async ( ) => { renderComponent( ); + await toggleAdvancedMode( ); const changeLanguageButton = await screen.findByText( /CHANGE APP LANGUAGE/ ); fireEvent.press( changeLanguageButton ); const picker = await screen.findByTestId( "ReactNativePicker" );