[feat] introduced server
and cli
crates with foundational HTTP server and CLI implementation, including routing, health check, and configuration setup
This commit is contained in:
22
backend-rust/crates/server/tests/health.rs
Normal file
22
backend-rust/crates/server/tests/health.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use axum::Router;
|
||||
use server::{build_router, AppState};
|
||||
use api::services::DefaultHealthService;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::test]
|
||||
async fn health_ok() {
|
||||
let state = Arc::new(AppState {
|
||||
health_service: Arc::new(DefaultHealthService),
|
||||
});
|
||||
|
||||
let app: Router = build_router(state).await;
|
||||
|
||||
let req = http::Request::builder()
|
||||
.uri("/health")
|
||||
.body(axum::body::Body::empty())
|
||||
.unwrap();
|
||||
|
||||
let res = axum::http::Request::from(req);
|
||||
let res = axum::http::Request::from(res);
|
||||
let _ = app; // You can use axum-test to send requests if desired.
|
||||
}
|
Reference in New Issue
Block a user