Skip to content

Commit e082876

Browse files
committed
test: require first-letter provider emoji fallback
1 parent 1c085df commit e082876

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

tests/provider_branding_contract_test.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,33 @@
2626
for provider_id, row in rows.items():
2727
assert isinstance(row, dict), provider_id
2828
assert str(row.get("name") or "").strip(), provider_id
29-
assert str(row.get("emoji") or "").strip(), provider_id
29+
emoji = str(row.get("emoji") or "").strip()
30+
assert emoji, provider_id
31+
assert emoji != "🔤", f"generic alphabet fallback is forbidden: {provider_id}"
32+
33+
# Providers for which no stronger semantic symbol was selected use their own
34+
# first initial as a regional-indicator emoji rather than a generic ABC marker.
35+
for provider_id, expected in {
36+
"animepahe": "🇦",
37+
"yflix": "🇾",
38+
"nakios": "🇳",
39+
"ctgmovies": "🇨",
40+
}.items():
41+
assert rows[provider_id]["emoji"] == expected, (provider_id, rows[provider_id])
3042

3143
spec = importlib.util.spec_from_file_location("provider_branding_contract", PATCH_FILE)
3244
assert spec is not None and spec.loader is not None
3345
module = importlib.util.module_from_spec(spec)
3446
spec.loader.exec_module(module)
3547

48+
# Future Core probes get the first alphabetic initial too; the committed 92/92
49+
# inventory remains mandatory for anything that is actually publishable.
50+
future = module._load_provider("future-provider-never-seen-before")
51+
assert future["name"] == "Future Provider Never Seen Before", future
52+
assert future["emoji"] == "🇫", future
53+
assert module._initial_emoji("4KHDHub Next") == "🇰"
54+
assert module._initial_emoji("") == "🇸"
55+
3656
source = 'globalThis.getStreams=async function(){return [{url:"https://example.com/video.m3u8",name:"old"}]};\n'
3757
output = module.apply(source, context={"provider_id": "peachify"})
3858
assert "NUVIO_GLOBAL_PROVIDER_BRANDING_V1" in output
@@ -45,7 +65,7 @@
4565
'\nPromise.resolve(globalThis.getStreams()).then(function(rows){'
4666
'if(!Array.isArray(rows)||rows.length!==1||rows[0].name!=="🍑 Peachify")'
4767
'{console.error(JSON.stringify(rows));process.exit(2)}'
48-
'console.log(rows[0].name)'
68+
'console.log(rows[0].name)'
4969
'}).catch(function(error){console.error(error);process.exit(3)});\n'
5070
)
5171
artifact = Path(handle.name)
@@ -63,4 +83,4 @@
6383
finally:
6484
artifact.unlink(missing_ok=True)
6585

66-
print(f"provider branding contract passed: providers={len(rows)} local_stream_fallback=emoji+clean_name")
86+
print(f"provider branding contract passed: providers={len(rows)} local_stream_fallback=semantic_or_initial_emoji+clean_name")

0 commit comments

Comments
 (0)