zero-to-production/tests/api/health_check.rs

21 lines
502 B
Rust
Raw Normal View History

2021-02-14 15:26:43 +00:00
use crate::helpers::spawn_app;
#[tokio::test]
async fn health_check_works() {
// Arrange
2021-02-14 15:26:43 +00:00
let app = spawn_app().await;
let client = reqwest::Client::new();
// Act
let response = client
// Use the returned application address
.get(&format!("{}/health_check", &app.address))
.send()
.await
.expect("Failed to execute request.");
// Assert
assert!(response.status().is_success());
assert_eq!(Some(0), response.content_length());
}