"""Tests for health check and root endpoints.""" from __future__ import annotations from fastapi.testclient import TestClient def test_root_returns_api_info(client: TestClient) -> None: """Root endpoint should return API name, version, and status.""" response = client.get("/") assert response.status_code == 200 data = response.json() assert data["name"] == "CrownCode Backend API" assert data["status"] == "running" assert "version" in data def test_health_endpoint(client: TestClient) -> None: """Health endpoint should return ok status with services info.""" response = client.get("/api/health") assert response.status_code == 200 data = response.json() assert data["status"] == "ok" assert "services" in data def test_health_reports_model_inventory(client: TestClient) -> None: """Health says what actually loaded, not just that the process is up.""" data = client.get("/api/health").json() models = data["models"] assert "xai" in models and "available" in models["xai"] assert models["xai"]["ensembleTotal"] == 11 assert "wav2vec2" in models and "clap" in models and "meta" in models assert models["jobs"]["running"] >= 0