From 2dd17dda8027bfe9c239bd62a062b6ccc0c3c227 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Sat, 4 Jul 2026 21:27:52 +0000 Subject: [PATCH] test(mgmt): display state/release endpoint smoke test Covers the idle path (empty /display/state + released:0 /display/release) on a unit-test host, exercising the wiring + auth without touching any global owner. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/punktfunk-host/src/mgmt.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/punktfunk-host/src/mgmt.rs b/crates/punktfunk-host/src/mgmt.rs index 5c7fde1..b3ce773 100644 --- a/crates/punktfunk-host/src/mgmt.rs +++ b/crates/punktfunk-host/src/mgmt.rs @@ -2758,6 +2758,30 @@ mod tests { ); } + /// The display state/release endpoints are wired + auth-gated. On the test host no backend has + /// created a display (and non-Windows reports none), so `/state` is empty and `/release` is a + /// no-op — the shapes + the "nothing to release" path, without touching any global owner. + #[tokio::test] + async fn display_state_and_release_empty() { + let app = test_app(test_state(), None); + + let (status, body) = send(&app, get_req("/api/v1/display/state")).await; + assert_eq!(status, StatusCode::OK); + assert_eq!( + body["displays"].as_array().map(|a| a.len()), + Some(0), + "no managed displays on an idle test host" + ); + + let (status, body) = send( + &app, + post_json("/api/v1/display/release", serde_json::json!({})), + ) + .await; + assert_eq!(status, StatusCode::OK); + assert_eq!(body["released"], 0); + } + #[tokio::test] async fn native_pairing_arm_show_and_unpair() { let np = Arc::new(