diff --git a/server/src/http/health.rs b/server/src/http/health.rs index d6c0cdc..8340ac1 100644 --- a/server/src/http/health.rs +++ b/server/src/http/health.rs @@ -39,6 +39,24 @@ impl HealthApi { mod tests { use super::*; + #[tokio::test] + async fn handler_health_returns_ok() { + let app = poem::Route::new().at("/health", poem::get(health)); + let cli = poem::test::TestClient::new(app); + let resp = cli.get("/health").send().await; + resp.assert_status_is_ok(); + resp.assert_text("ok").await; + } + + #[test] + fn health_status_serializes_to_json() { + let status = HealthStatus { + status: "ok".to_string(), + }; + let json = serde_json::to_value(&status).unwrap(); + assert_eq!(json["status"], "ok"); + } + #[tokio::test] async fn api_health_returns_ok_status() { let api = HealthApi;