chore: cargo fmt — fix pre-existing fmt violations #192
2 changed files with 15 additions and 11 deletions
|
|
@ -279,11 +279,7 @@ async fn socket_rejects_double_claim_of_same_task() {
|
|||
.await;
|
||||
let b_id = b["data"]["id"].as_str().unwrap().to_string();
|
||||
|
||||
let task = send_command(
|
||||
&socket_path,
|
||||
r#"{"cmd":"create-task","title":"contended"}"#,
|
||||
)
|
||||
.await;
|
||||
let task = send_command(&socket_path, r#"{"cmd":"create-task","title":"contended"}"#).await;
|
||||
let task_id = task["data"]["id"].as_str().unwrap().to_string();
|
||||
|
||||
// First claim wins.
|
||||
|
|
@ -292,7 +288,10 @@ async fn socket_rejects_double_claim_of_same_task() {
|
|||
&format!(r#"{{"cmd":"claim-task","task_id":"{task_id}","agent_id":"{a_id}"}}"#),
|
||||
)
|
||||
.await;
|
||||
assert!(c1["ok"].as_bool().unwrap_or(false), "first claim should win: {c1}");
|
||||
assert!(
|
||||
c1["ok"].as_bool().unwrap_or(false),
|
||||
"first claim should win: {c1}"
|
||||
);
|
||||
|
||||
// Second claim of the same task is rejected — not a silent steal.
|
||||
let c2 = send_command(
|
||||
|
|
@ -300,7 +299,11 @@ async fn socket_rejects_double_claim_of_same_task() {
|
|||
&format!(r#"{{"cmd":"claim-task","task_id":"{task_id}","agent_id":"{b_id}"}}"#),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(c2["ok"].as_bool(), Some(false), "second claim must be rejected: {c2}");
|
||||
assert_eq!(
|
||||
c2["ok"].as_bool(),
|
||||
Some(false),
|
||||
"second claim must be rejected: {c2}"
|
||||
);
|
||||
|
||||
// The task still belongs to the first agent.
|
||||
let claimed = send_command(&socket_path, r#"{"cmd":"list-tasks","status":"claimed"}"#).await;
|
||||
|
|
|
|||
|
|
@ -711,11 +711,12 @@ mod tests {
|
|||
#[test]
|
||||
fn test_claim_task_not_found() {
|
||||
let store = Store::open_memory().unwrap();
|
||||
let agent = store
|
||||
.register_agent("a", serde_json::json!(["x"]))
|
||||
.unwrap();
|
||||
let agent = store.register_agent("a", serde_json::json!(["x"])).unwrap();
|
||||
let result = store.claim_task("nonexistent", &agent.id);
|
||||
assert!(matches!(result, Err(StoreError::NotFound(_))), "got {result:?}");
|
||||
assert!(
|
||||
matches!(result, Err(StoreError::NotFound(_))),
|
||||
"got {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue