//! HTTP integration tests for basic endpoint functionality. //! //! Coverage: //! - GET /v1/health - Health check endpoint //! - Basic response structure validation //! - Server availability tests #![allow(clippy::expect_used)] mod common; use axum::{ body::Body, http::{Request, StatusCode}, }; use tower::ServiceExt; use stemedb_api::create_router; // ============================================================================ // Health Check Tests // ============================================================================ #[tokio::test] async fn test_health_check() { let env = common::create_test_env().await; let app = create_router(env.state); let request = Request::builder().uri("/v1/health").method("GET").body(Body::empty()).expect("Request"); let response = app.oneshot(request).await.expect("Request"); assert_eq!(response.status(), StatusCode::OK); let body = axum::body::to_bytes(response.into_body(), usize::MAX).await.expect("Body"); let json: serde_json::Value = serde_json::from_slice(&body).expect("JSON"); assert_eq!(json["status"], "healthy"); assert!(json["version"].is_string()); assert_eq!(json["assertions_count"], 0); }