story-kit: merge 99_story_test_coverage_http_health_rs_to_100
This commit is contained in:
@@ -39,6 +39,24 @@ impl HealthApi {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
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]
|
#[tokio::test]
|
||||||
async fn api_health_returns_ok_status() {
|
async fn api_health_returns_ok_status() {
|
||||||
let api = HealthApi;
|
let api = HealthApi;
|
||||||
|
|||||||
Reference in New Issue
Block a user