fix: tests

This commit is contained in:
Kristofers Solo 2025-06-22 13:57:59 +03:00
parent 8f60a5d385
commit 44f586a369
Signed by: kristoferssolo
GPG Key ID: 8687F2D3EEE6F0ED
2 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@ use reqwest::Client;
#[tokio::test] #[tokio::test]
async fn health_check() { async fn health_check() {
let app = spawn_app().await; let app = spawn_app().await;
let url = format!("{}/health_check", &app.addr); let url = format!("http://{}/api/v1/health_check", &app.addr);
let client = Client::new(); let client = Client::new();
let response = client let response = client
.get(&url) .get(&url)

View File

@ -21,6 +21,7 @@ static TRACING: Lazy<()> = Lazy::new(|| {
} }
}); });
#[derive(Debug)]
pub struct TestApp { pub struct TestApp {
pub _pool: PgPool, pub _pool: PgPool,
pub addr: SocketAddr, pub addr: SocketAddr,
@ -46,7 +47,7 @@ pub async fn spawn_app() -> TestApp {
.expect("Failed to build application."); .expect("Failed to build application.");
let addr = application.addr(); let addr = application.addr();
let _ = tokio::spawn(application.start()).await; tokio::spawn(application.start());
TestApp { TestApp {
_pool: get_connection_pool(&config.database), _pool: get_connection_pool(&config.database),