test: drop unnecessary Result wrap in bash status test helper

clippy::unnecessary_wraps — the helper always returns Ok. Build the
DaemonResponse directly and wrap with Ok() at the call sites. Fixes the
CI clippy failure on this PR.
This commit is contained in:
iris 2026-06-05 20:11:46 +02:00 committed by mara
commit 153870ec3a

View file

@ -261,30 +261,29 @@ async fn main() -> Result<()> {
#[cfg(test)]
mod status_hint_tests {
use super::{BASH_IDLE_WAIT_HINT, render_bash_status};
use anyhow::Result;
use hive_bash_mcp::protocol::DaemonResponse;
fn ok(status: &str) -> Result<DaemonResponse> {
Ok(DaemonResponse::Ok {
fn status_resp(status: &str) -> DaemonResponse {
DaemonResponse::Ok {
payload: serde_json::json!({ "status": status, "started_at": 1 }),
})
}
}
#[test]
fn running_task_after_wait_appends_idle_hint() {
let out = render_bash_status("t1", ok("running"), true);
let out = render_bash_status("t1", Ok(status_resp("running")), true);
assert!(out.contains(BASH_IDLE_WAIT_HINT));
}
#[test]
fn running_task_without_wait_has_no_hint() {
let out = render_bash_status("t1", ok("running"), false);
let out = render_bash_status("t1", Ok(status_resp("running")), false);
assert!(!out.contains(BASH_IDLE_WAIT_HINT));
}
#[test]
fn finished_task_after_wait_has_no_hint() {
let out = render_bash_status("t1", ok("done"), true);
let out = render_bash_status("t1", Ok(status_resp("done")), true);
assert!(!out.contains(BASH_IDLE_WAIT_HINT));
}
}