diff --git a/config/eslint/eslint.seatbelt.tsv b/config/eslint/eslint.seatbelt.tsv index fca0aac97ba6..3689ed1fcb15 100644 --- a/config/eslint/eslint.seatbelt.tsv +++ b/config/eslint/eslint.seatbelt.tsv @@ -1623,7 +1623,7 @@ "../../tests/ui/ContactMethodsPageTest.tsx" "@typescript-eslint/no-unsafe-type-assertion" 4 "../../tests/ui/CountrySelectionListTest.tsx" "@typescript-eslint/no-unsafe-type-assertion" 3 "../../tests/ui/CountrySelectorModalTest.tsx" "@typescript-eslint/no-unsafe-type-assertion" 3 -"../../tests/ui/DynamicCountrySelectionPageTest.tsx" "@typescript-eslint/no-unsafe-type-assertion" 7 +"../../tests/ui/DynamicCountrySelectionPageTest.tsx" "@typescript-eslint/no-unsafe-type-assertion" 3 "../../tests/ui/DynamicPaymentCardCurrencySelectorPageTest.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1 "../../tests/ui/DynamicReportDetailsPageTest.tsx" "@typescript-eslint/no-unsafe-type-assertion" 2 "../../tests/ui/FloatingActionButtonTest.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1 diff --git a/src/pages/settings/Profile/PersonalDetails/DynamicCountrySelectionPage.tsx b/src/pages/settings/Profile/PersonalDetails/DynamicCountrySelectionPage.tsx index c6d5153b25ee..310e689dd6fa 100644 --- a/src/pages/settings/Profile/PersonalDetails/DynamicCountrySelectionPage.tsx +++ b/src/pages/settings/Profile/PersonalDetails/DynamicCountrySelectionPage.tsx @@ -25,7 +25,7 @@ type DynamicCountrySelectionPageProps = PlatformStackScreenProps; const mockUseState = React.useState; const mockAllCountries = CONST.ALL_COUNTRIES; @@ -56,8 +60,8 @@ describe('DynamicCountrySelectionPage', () => { it('pins the saved country to the top on reopen and wires debounced focus sync', () => { render( ({params: {country: 'US'}})} + navigation={createMock({})} />, ); @@ -76,8 +80,8 @@ describe('DynamicCountrySelectionPage', () => { it('keeps natural filtered ordering while search is active', () => { render( ({params: {country: 'US'}})} + navigation={createMock({})} />, ); @@ -102,4 +106,17 @@ describe('DynamicCountrySelectionPage', () => { expect(searchedProps?.data.map((item) => item.keyForList)).toEqual(expectedSearchResults.map((item) => item.keyForList)); expect(searchedProps?.searchValueForFocusSync).toBe('Uni'); }); + + it('renders without crashing when the route has no params', () => { + render( + ({})} + navigation={createMock({})} + />, + ); + + const selectionListProps = mockedSelectionList.mock.lastCall?.[0]; + expect(selectionListProps?.initiallyFocusedItemKey).toBeUndefined(); + expect(selectionListProps?.data.every((item) => !item.isSelected)).toBe(true); + }); });