"""SPA-shell pages (/calendar, /day, /score, /compare, /legend, /alerts) and
static-asset serving -- moved here from backend/tests/web/test_api.py
(repo-split Stage 7a: frontend now owns these, not backend). These routes are static
shells/assets that don't call the backend, so the hermetic `client` fixture serves them."""
B = "/thermograph"  # matches THERMOGRAPH_BASE set in tests/conftest.py


def test_calendar_serves_with_origin_filled_in(client):
    r = client.get(f"{B}/calendar")
    assert r.status_code == 200
    assert "text/html" in r.headers["content-type"]
    assert "__ORIGIN__" not in r.text
    assert client.head(f"{B}/calendar").status_code == 200


def test_other_spa_shells_serve(client):
    for path in ("/day", "/score", "/compare", "/legend", "/alerts"):
        r = client.get(f"{B}{path}")
        assert r.status_code == 200, path
        assert "__ORIGIN__" not in r.text, path


def test_static_asset_serves(client):
    r = client.get(f"{B}/app.js")
    assert r.status_code == 200
    assert "javascript" in r.headers["content-type"]


def test_old_static_index_is_gone(client):
    """index.html must not linger behind the static mount as indexable
    duplicate content now that / is server-rendered (moved here from
    backend/tests/web/test_homepage.py, repo-split Stage 7a -- frontend's own
    StaticFiles mount is what actually answers this now)."""
    assert client.get(f"{B}/index.html").status_code == 404
