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:
parent
d34c594f2b
commit
153870ec3a
1 changed files with 6 additions and 7 deletions
|
|
@ -261,30 +261,29 @@ async fn main() -> Result<()> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod status_hint_tests {
|
mod status_hint_tests {
|
||||||
use super::{BASH_IDLE_WAIT_HINT, render_bash_status};
|
use super::{BASH_IDLE_WAIT_HINT, render_bash_status};
|
||||||
use anyhow::Result;
|
|
||||||
use hive_bash_mcp::protocol::DaemonResponse;
|
use hive_bash_mcp::protocol::DaemonResponse;
|
||||||
|
|
||||||
fn ok(status: &str) -> Result<DaemonResponse> {
|
fn status_resp(status: &str) -> DaemonResponse {
|
||||||
Ok(DaemonResponse::Ok {
|
DaemonResponse::Ok {
|
||||||
payload: serde_json::json!({ "status": status, "started_at": 1 }),
|
payload: serde_json::json!({ "status": status, "started_at": 1 }),
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn running_task_after_wait_appends_idle_hint() {
|
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));
|
assert!(out.contains(BASH_IDLE_WAIT_HINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn running_task_without_wait_has_no_hint() {
|
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));
|
assert!(!out.contains(BASH_IDLE_WAIT_HINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn finished_task_after_wait_has_no_hint() {
|
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));
|
assert!(!out.contains(BASH_IDLE_WAIT_HINT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue