Skip to content

Commit e3ea06a

Browse files
committed
GH-38: Add a test case for advanced country filtering
1 parent f98255a commit e3ea06a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/hooks.test.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,23 @@ describe("Verifying the functionality of hooks", () => {
124124
expect((result.current.metadata as any)[0]).toBe("am");
125125
})
126126

127+
it("Check usePhone for advanced country filtering", () => {
128+
const {result} = renderHook(usePhoneTester, {
129+
initialProps: {
130+
onlyCountries: ["ae", "gb", "us"] as any,
131+
excludeCountries: ["1907", "1205", "1251"] as any,
132+
}
133+
});
134+
135+
expect(result.current.countriesList.map(c => c[2]).includes("1"));
136+
expect(result.current.countriesList.map(c => c[2]).includes("44"));
137+
expect(result.current.countriesList.map(c => c[2]).includes("971"));
138+
139+
expect(!result.current.countriesList.map(c => c[2]).includes("1907"));
140+
expect(!result.current.countriesList.map(c => c[2]).includes("1205"));
141+
expect(!result.current.countriesList.map(c => c[2]).includes("1251"));
142+
})
143+
127144
it("Check usePhone without parentheses", () => {
128145
const {result} = renderHook(usePhoneTester, {
129146
initialProps: {

0 commit comments

Comments
 (0)