email_newsletter_api/tests/health_check.rs
minhtrannhat 84fc74a0d1
feat: subscribe API route skeleton
- Added `serde` crate for serialisation or deserialisation of data
- Added test cases for the `subscribe` API route
- Refactor the testing setup to another module `test_utils`
- use random TCP port for testing
2024-04-22 17:00:55 -04:00

20 lines
449 B
Rust

mod test_utils;
use test_utils::spawn_app;
#[tokio::test]
async fn health_check_works() {
let server_address = spawn_app();
let client = reqwest::Client::new();
let response = client
.get(&format!("{}/health_check", &server_address))
.send()
.await
.expect("Failed to execute health_check request.");
assert!(response.status().is_success());
assert_eq!(Some(0), response.content_length());
}