mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-11-25 18:21:02 +00:00
20 lines
505 B
Rust
20 lines
505 B
Rust
use crate::helpers::spawn_app;
|
|
|
|
#[actix_rt::test]
|
|
async fn health_check_works() {
|
|
// Arrange
|
|
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());
|
|
}
|