from __future__ import annotations

import httpx


async def test_root_returns_ok(client: httpx.AsyncClient) -> None:
    resp = await client.get("/")
    assert resp.status_code == 200
    assert resp.json()["status"] == "ok"


async def test_health_endpoint(client: httpx.AsyncClient) -> None:
    resp = await client.get("/health")
    assert resp.status_code == 200


async def test_response_carries_request_id_header(client: httpx.AsyncClient) -> None:
    resp = await client.get("/health")
    assert resp.headers.get("x-request-id")


async def test_propagates_incoming_request_id(client: httpx.AsyncClient) -> None:
    resp = await client.get("/health", headers={"x-request-id": "abc123"})
    assert resp.headers["x-request-id"] == "abc123"
