Skip to content

Commit 7b7adb6

Browse files
committed
test: pin exact E.164 country membership in the catalog test
Assert COUNTRIES' codes against an independent hardcoded list of the 244 expected ISO codes, so a well-formed unique substitution that preserves the count still fails. Count, format, uniqueness, and flag checks are unchanged.
1 parent 027653b commit 7b7adb6

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎test/phone-input.test.tsx‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,9 +691,30 @@ describe("PhoneInput full country list", () => {
691691
.map((ch) => String.fromCodePoint((ch.codePointAt(0) ?? 0) - 0x1f1e6 + 65))
692692
.join("");
693693

694+
// The exact E.164 membership, pinned independently of the source table so a
695+
// well-formed, unique substitution that keeps the count still fails. Update
696+
// this list (and the count below) whenever the ITU-T country list changes.
697+
const EXPECTED_CODES = `
698+
AD AE AF AG AI AL AM AO AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ
699+
BL BM BN BO BQ BR BS BT BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR
700+
CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO
701+
FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GT GU GW GY HK HN HR HT HU
702+
ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY
703+
KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO
704+
MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM
705+
PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD
706+
SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TG TH TJ TK TL
707+
TM TN TO TR TT TV TW TZ UA UG US UY UZ VA VC VE VG VI VN VU WF WS XK YE
708+
YT ZA ZM ZW
709+
`
710+
.trim()
711+
.split(/\s+/);
712+
694713
it("exports a full E.164 table with derived names and flags", () => {
695714
// Update this expected count whenever the ITU-T E.164 country list changes.
696715
expect(COUNTRIES.length).toBe(244);
716+
// Exact membership: a substituted country keeps the count but not the set.
717+
expect(COUNTRIES.map((c) => c.code).sort()).toEqual([...EXPECTED_CODES].sort());
697718

698719
const seen = new Set<string>();
699720
for (const c of COUNTRIES) {

0 commit comments

Comments
 (0)