"""Tests for the FastAPI app health and SPA serving endpoints.""" from pathlib import Path import pytest from agenteval.web.app import app from fastapi.testclient import TestClient @pytest.fixture() def client(): with TestClient(app) as c: yield c def test_health_endpoint(client): resp = client.get("/api/health") assert resp.status_code == 200 data = resp.json() assert data["status"] == "ok" assert "version" in data def test_serve_spa_returns_404_when_dist_not_built(client, monkeypatch): from agenteval.web import app as app_module monkeypatch.setattr(app_module, "WEB_DIST", Path("/non/existent/dist")) resp = client.get("/some/random/path") assert resp.status_code == 404 assert resp.json()["detail"] == "frontend not built"