use axum::{Router, routing::get}; use utoipa::OpenApi; #[derive(OpenApi)] #[openapi(paths(health))] pub struct HealthApi; pub fn routes_health() -> Router { Router::new().route("/health", get(health)) } /// Health check #[utoipa::path( get, path = "/health", tag = "health", responses((status = 200, description = "Service is healthy")) )] async fn health() -> &'static str { "up" } #[cfg(test)] mod tests { use axum::{Router, routing::get}; use axum_test::TestServer; use crate::web::routes_health::health; #[tokio::test] async fn test_route_health() { let app = Router::new().route(&"/health", get(health)); let server = TestServer::new(app); let response = server.get("/health").await; response.assert_status_ok().assert_text("up"); } }