"""Tests for the Padelnomics Score methodology page."""


async def test_en_returns_200(client):
    resp = await client.get("/en/padelnomics-score")
    assert resp.status_code == 200
    text = await resp.get_data(as_text=True)
    assert "Padelnomics Score" in text
    assert "padelnomics" in text


async def test_de_returns_200(client):
    resp = await client.get("/de/padelnomics-score")
    assert resp.status_code == 200
    text = await resp.get_data(as_text=True)
    assert "Padelnomics Score" in text
    assert "padelnomics" in text


async def test_old_market_score_redirects(client):
    resp = await client.get("/en/market-score")
    assert resp.status_code == 301
    assert "/padelnomics-score" in resp.headers["Location"]


async def test_de_old_market_score_redirects(client):
    resp = await client.get("/de/market-score")
    assert resp.status_code == 301
    assert "/padelnomics-score" in resp.headers["Location"]


async def test_contains_jsonld(client):
    resp = await client.get("/en/padelnomics-score")
    text = await resp.get_data(as_text=True)
    assert '"@type": "WebPage"' in text
    assert '"@type": "FAQPage"' in text
    assert '"@type": "BreadcrumbList"' in text


async def test_contains_faq_section(client):
    resp = await client.get("/en/padelnomics-score")
    text = await resp.get_data(as_text=True)
    assert "Frequently Asked Questions" in text
    assert "<details" in text


async def test_de_contains_faq_section(client):
    resp = await client.get("/de/padelnomics-score")
    text = await resp.get_data(as_text=True)
    assert "Häufige Fragen" in text


async def test_contains_og_tags(client):
    resp = await client.get("/en/padelnomics-score")
    text = await resp.get_data(as_text=True)
    assert 'og:title' in text
    assert 'og:description' in text


async def test_footer_has_padelnomics_score_link(client):
    resp = await client.get("/en/padelnomics-score")
    text = await resp.get_data(as_text=True)
    assert "/padelnomics-score" in text
    assert "Padelnomics Score" in text
