Files
ewoooc/tests/test_pchome_dashboard_ai_wording_guard.py
ogt c1cb994d61
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
收斂 PChome AI 第一視窗文案守門
2026-07-02 14:04:18 +08:00

48 lines
1.5 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_pchome_dashboard_ai_first_viewport_uses_product_language():
route_source = (ROOT / "routes/dashboard_routes.py").read_text(encoding="utf-8")
dashboard = (ROOT / "templates/dashboard_v2.html").read_text(encoding="utf-8")
first_viewport = dashboard.split('<div class="growth-automation-panel"', 1)[1].split(
'<div class="growth-command-grid"',
1,
)[0]
assert "找同款 · 決策 · 證據 · 落地 · 回讀 · 留存" in first_viewport
assert "主流程阻斷 0 · 回讀待建立 · 證據留存待建立" in route_source
assert "· 異動 {controlled_apply_drift_count} · 留存" in route_source
assert "'label': '最新回讀'" in route_source
assert "'label': '證據留存'" in route_source
assert "資料寫入" in route_source
assert "清理建議" in route_source
forbidden_first_viewport_terms = [
"retention",
"Compact",
"Artifact",
"DB writes",
"prune",
"endpoint",
"commit",
"JSON",
"table",
]
for marker in forbidden_first_viewport_terms:
assert marker not in first_viewport
forbidden_visible_route_literals = [
"· drift ",
"· retention ",
"'Compact 回讀'",
"'Artifact retention'",
"DB writes",
"prune 候選",
"retention 待建立",
]
for marker in forbidden_visible_route_literals:
assert marker not in route_source