This commit is contained in:
@@ -403,7 +403,7 @@ def test_dashboard_v2_is_production_default_and_uses_real_dashboard_data():
|
||||
assert "高業績商品作戰清單" in dashboard
|
||||
assert "業績 × MOMO 價格 × 下一步" in dashboard
|
||||
assert "growth.mapping_rate" in dashboard
|
||||
assert "找同款 · 決策 · 證據 · 落地 · 回讀 · retention" in dashboard
|
||||
assert "找同款 · 決策 · 證據 · 落地 · 回讀 · 留存" in dashboard
|
||||
assert "growth.ai_automation_first_viewport" in dashboard
|
||||
assert "ai_first_viewport.title" in dashboard
|
||||
assert "ai_first_viewport.metric" in dashboard
|
||||
|
||||
47
tests/test_pchome_dashboard_ai_wording_guard.py
Normal file
47
tests/test_pchome_dashboard_ai_wording_guard.py
Normal file
@@ -0,0 +1,47 @@
|
||||
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
|
||||
Reference in New Issue
Block a user