from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]


def test_ai_and_system_pages_pass_active_page_to_v3_shell():
    ai_routes = (ROOT / "routes/ai_routes.py").read_text(encoding="utf-8")
    system_routes = (ROOT / "routes/system_public_routes.py").read_text(encoding="utf-8")

    assert "render_template('ai_recommend.html'," in ai_routes
    assert "active_page='ai_recommend'" in ai_routes
    assert "render_template('ai_history.html', active_page='ai_history')" in ai_routes
    assert "render_template('ai_intelligence.html', active_page='ai_intelligence')" in ai_routes
    assert "render_template('logs.html', active_page='logs')" in system_routes


def test_ai_and_logs_titles_use_ewoooc_brand():
    templates = [
        ROOT / "templates/ai_recommend.html",
        ROOT / "templates/ai_intelligence.html",
        ROOT / "templates/ai_history.html",
        ROOT / "templates/logs.html",
    ]

    for template_path in templates:
        source = template_path.read_text(encoding="utf-8")
        assert "EwoooC" in source
        assert "WOOO TECH" not in source
