From 827f0dd5116bd1d801e94279d5a6d429d6d67a06 Mon Sep 17 00:00:00 2001 From: Riz Ashraf Date: Sat, 10 Oct 2026 20:27:08 +0100 Subject: [PATCH] test: Fix test_spawn_watcher_invalid_path to catch expected panic --- server/src/watcher.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/watcher.rs b/server/src/watcher.rs index c542f11..0d9fe0c 100644 --- a/server/src/watcher.rs +++ b/server/src/watcher.rs @@ -237,7 +237,10 @@ mod tests { #[tokio::test] async fn test_spawn_watcher_invalid_path() { - let state = Arc::new(MemoryState::new("/nonexistent/path")); - spawn_watcher(state); + let result = std::panic::catch_unwind(|| { + let state = Arc::new(MemoryState::new("/nonexistent/path")); + spawn_watcher(state); + }); + assert!(result.is_err(), "Expected MemoryState::new to panic due to persistence failure on invalid path"); } }