From 7cbafdfb3141c9ac3852dc31db336c7d8148ced2 Mon Sep 17 00:00:00 2001 From: oabrivard Date: Thu, 26 Mar 2026 10:46:39 +0100 Subject: [PATCH] fix: create test static dir to prevent ServeDir/ServeFile hang The SPA fallback uses ServeDir/ServeFile which can hang when the directory doesn't exist. Create it in TestApp::new() with a minimal index.html. Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/tests/common/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/tests/common/mod.rs b/backend/tests/common/mod.rs index b327264..c9d642b 100644 --- a/backend/tests/common/mod.rs +++ b/backend/tests/common/mod.rs @@ -117,6 +117,13 @@ impl TestApp { turnstile_site_key: "test-site-key".into(), }; + // Create the static dir so ServeDir/ServeFile don't hang + let _ = std::fs::create_dir_all(&config.static_dir); + let index_path = format!("{}/index.html", config.static_dir); + if !std::path::Path::new(&index_path).exists() { + let _ = std::fs::write(&index_path, "test"); + } + let http_client = reqwest::Client::new(); let state = AppState::new(config.clone(), pool.clone(), http_client); let router = build_router(state, &config);