mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
fix(radio): resolve common country exonyms Intl.DisplayNames omits (#232)
Recognize common country names and exonyms in Radio country requests and station filtering. Keep ambiguous country names rejected.
This commit is contained in:
1 parent
024738a8d2
commit
87a92c8bc4
4 files changed
+57
-3
No files matched your search
@@ -18,6 +18,37 @@ test('Radio country normalization maps ISO codes and bounded common names', () =
|
||||
}
|
||||
});
|
||||
|
||||
test('Radio country normalization resolves common English names/exonyms ICU misses', () => {
|
||||
// Each of these fails closed against the Intl.DisplayNames primary label
|
||||
// alone (e.g. TR is "Türkiye", MM is "Myanmar (Burma)", AE is "United Arab
|
||||
// Emirates"), so a request like "play radio in Turkey" would return nothing.
|
||||
for (const [input, code] of [
|
||||
['Turkey', 'TR'],
|
||||
['Turkiye', 'TR'],
|
||||
['Myanmar', 'MM'],
|
||||
['Burma', 'MM'],
|
||||
['UAE', 'AE'],
|
||||
['U.A.E.', 'AE'],
|
||||
['Holland', 'NL'],
|
||||
['Swaziland', 'SZ'],
|
||||
['East Timor', 'TL'],
|
||||
['Cabo Verde', 'CV'],
|
||||
['Vatican', 'VA'],
|
||||
]) {
|
||||
const result = normalizeRadioCountryInput(input);
|
||||
assert.equal(result.valid, true, input);
|
||||
assert.equal(result.code, code, input);
|
||||
}
|
||||
});
|
||||
|
||||
test('Ambiguous country names still fail closed (no broadened selection)', () => {
|
||||
// Two states share the name "Congo" (CD/CG), so a bare mention must not
|
||||
// resolve to either — it stays low-confidence and fails closed.
|
||||
for (const input of ['Congo', 'Korea']) {
|
||||
assert.equal(normalizeRadioCountryInput(input).valid, false, input);
|
||||
}
|
||||
});
|
||||
|
||||
test('Radio country normalization rejects malformed, non-ISO, and oversized values', () => {
|
||||
for (const input of [
|
||||
'ZZ',
|
||||
|
||||
Reference in new issue
Block a user