diff --git a/crates/weft-appd/src/main.rs b/crates/weft-appd/src/main.rs index ed9771c..5309b1e 100644 --- a/crates/weft-appd/src/main.rs +++ b/crates/weft-appd/src/main.rs @@ -542,6 +542,30 @@ mod tests { assert!(matches!(resp, Response::Error { .. })); } + #[tokio::test] + async fn session_stops_when_runtime_bin_absent() { + unsafe { std::env::remove_var("WEFT_RUNTIME_BIN") }; + let reg = make_registry(); + let ack = dispatch( + Request::LaunchApp { + app_id: "com.test.nobinary".into(), + surface_id: 0, + }, + ®, + ) + .await; + let session_id = match ack { + Response::LaunchAck { session_id, .. } => session_id, + _ => panic!("expected LaunchAck"), + }; + tokio::task::yield_now().await; + let state = reg.lock().await.state(session_id); + assert!( + matches!(state, AppStateKind::Stopped), + "session should be Stopped when WEFT_RUNTIME_BIN is absent" + ); + } + #[tokio::test] async fn running_sessions_excludes_stopped() { let reg = make_registry();