use crate::common::TestServer;

#[tokio::test]
async fn health_endpoint_returns_ok() {
    let server = TestServer::start().await;

    let resp = server.get("/api/v1/health").await;
    assert_eq!(resp.status(), 200);

    let body: serde_json::Value = resp.json().await.unwrap();
    assert_eq!(body["status"], "ok");

    server.cleanup().await;
}

#[tokio::test]
async fn stats_overview_returns_zeroes_on_empty_db() {
    let server = TestServer::start().await;

    let resp = server.get("/api/v1/stats/overview").await;
    assert_eq!(resp.status(), 200);

    let body: serde_json::Value = resp.json().await.unwrap();
    let data = &body["data"];
    assert_eq!(data["repositories"], 0);
    assert_eq!(data["total_findings"], 0);

    server.cleanup().await;
}
