Skip to content

Commit 8518adb

Browse files
committed
test: Improve CountrySelector test with error handling
1 parent 68d3d21 commit 8518adb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/firebaseui-react/tests/unit/components/country-selector.test.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ describe("CountrySelector Component", () => {
5959
// Check if onChange was called with the new country
6060
expect(mockOnChange).toHaveBeenCalledTimes(1);
6161
expect(mockOnChange).toHaveBeenCalledWith(newCountry);
62+
} else {
63+
// Fail the test if no different country is found
64+
expect.fail(
65+
"No different country found in countryData. Test cannot proceed."
66+
);
6267
}
6368
});
6469

@@ -81,6 +86,9 @@ describe("CountrySelector Component", () => {
8186
expect(usOption?.textContent).toBe(
8287
`${usCountry.dialCode} (${usCountry.name})`
8388
);
89+
} else {
90+
// Fail the test if US country is not found
91+
expect.fail("US country not found in countryData. Test cannot proceed.");
8492
}
8593
});
8694
});

0 commit comments

Comments
 (0)