college/Summer-2024/CS-3443/LakeWatch/LakeWatchAPI/tests/api/v1/status.rs

20 lines
573 B
Rust

use lakewatch::v1::status::domain::ApiStatus;
use sqlx::PgPool;
#[sqlx::test]
async fn status_returns_200_ok(pool: PgPool) {
let app = crate::helpers::TestApp::spawn(&pool).await;
let client = reqwest::Client::new();
println!("{}", app.url("/v1/status"));
let response = client
.get(app.url("/v1/status"))
.send()
.await
.expect("Failed to execute request");
assert!(response.status().is_success());
assert_eq!(
response.text().await.unwrap(),
serde_json::to_string(&ApiStatus::Ok).unwrap()
);
}