Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

test(host): satisfy the new clippy assert_is_empty lint

leepokai10c8df5985bd
diff --git a/host/src/chat/team.rs b/host/src/chat/team.rs
index d8af9a0c..3e5d1c59 100644
--- a/host/src/chat/team.rs
+++ b/host/src/chat/team.rs
@@ -475,7 +475,7 @@ mod tests {
assert!(f.request(" ").await.unwrap().is_err());
f.hub.delete_bot("b").unwrap();
assert!(f.request("deleted").await.unwrap().is_err());
- assert!(f.prompts().is_empty());
+ assert_eq!(f.prompts().len(), 0);
f.shutdown().await;
}
diff --git a/host/src/market/requests.rs b/host/src/market/requests.rs
index 1f0569de..bc5e4c20 100644
--- a/host/src/market/requests.rs
+++ b/host/src/market/requests.rs
@@ -362,7 +362,7 @@ mod tests {
let id = r["requestId"].as_str().unwrap();
assert!(finish(&hub, &json!({"entryId":id,"value":"wrong"})).await.is_err());
assert_eq!(hub.store.entry(id).unwrap().data["connectionRequest"]["status"], "pending");
- assert!(hub.store.bot("bot").unwrap().unwrap().config.connectors.is_empty());
+ assert_eq!(hub.store.bot("bot").unwrap().unwrap().config.connectors.len(), 0);
assert!(hub.store.entry(&format!("connection-ack-{id}")).is_none());
hub.shutdown().await;
std::fs::remove_dir_all(dir).unwrap();
diff --git a/host/src/remote/channel.rs b/host/src/remote/channel.rs
index dfcbfd0e..5376442b 100644
--- a/host/src/remote/channel.rs
+++ b/host/src/remote/channel.rs
@@ -819,7 +819,7 @@ mod tests {
assert_eq!(code, 4003);
assert_eq!(reject["code"], "revoked");
assert!(hub.store.push_tickets().is_empty());
- assert!(hub.store.activity_tickets("b1").is_empty());
+ assert_eq!(hub.store.activity_tickets("b1").len(), 0);
tokio::time::sleep(Duration::from_millis(50)).await;
assert!(!hub.ios_connected(), "the events subscription ended with the channel");
assert!(hub.connected.locked().is_empty());
diff --git a/host/src/remote/cloud.rs b/host/src/remote/cloud.rs
index 3b6004ba..97fe4ba8 100644
--- a/host/src/remote/cloud.rs
+++ b/host/src/remote/cloud.rs
@@ -761,7 +761,7 @@ mod tests {
decide(&hub, "req_ok", true).await.unwrap();
let d = hub.store.device(&b64(&dk)).unwrap();
assert_eq!((d.source, d.grant_id.as_deref()), (DeviceSource::Account, Some("grt_new")));
- assert!(hub.cloud.requests_json().is_empty());
+ assert_eq!(hub.cloud.requests_json().len(), 0);
}
#[tokio::test]
diff --git a/host/src/store.rs b/host/src/store.rs
index 8d78f571..1b9071de 100644
--- a/host/src/store.rs
+++ b/host/src/store.rs
@@ -980,7 +980,7 @@ mod tests {
};
assert_eq!(texts(&["SWIFT", "6"]), ["Swift 6 strict mode is on", "我們用 Swift 6 寫 Codync"]);
assert_eq!(texts(&["codync", "寫"]), ["我們用 Swift 6 寫 Codync"]);
- assert!(texts(&["narration"]).is_empty());
+ assert_eq!(texts(&["narration"]).len(), 0);
}
#[test]
@@ -1068,7 +1068,7 @@ mod tests {
assert_eq!(s.push_tickets().iter().map(|t| t.ticket.as_str()).collect::<Vec<_>>(), ["t2"]);
assert_eq!(s.activity_tickets("b1"), ["a2"]);
assert_eq!(s.take_activity_tickets("b1"), ["a2"]);
- assert!(s.activity_tickets("b1").is_empty());
+ assert_eq!(s.activity_tickets("b1").len(), 0);
}
#[test]
@@ -1101,7 +1101,7 @@ mod tests {
s.add_activity_ticket("other-bot", "bot2", "phone").unwrap();
assert_eq!(s.activity_tickets("bot"), ["new-activity"]);
s.remove_push_ticket("new-activity").unwrap();
- assert!(s.activity_tickets("bot").is_empty());
+ assert_eq!(s.activity_tickets("bot").len(), 0);
assert_eq!(s.activity_tickets("bot2"), ["other-bot"]);
}
diff --git a/host/tests/routines_e2e.rs b/host/tests/routines_e2e.rs
index 478e9748..506330d3 100644
--- a/host/tests/routines_e2e.rs
+++ b/host/tests/routines_e2e.rs
@@ -235,7 +235,7 @@ async fn routines_execute_pause_deduplicate_and_reject_wrong_webhook_keys() {
assert_eq!(restored["routines"][0]["enabled"], false);
assert_eq!(restored["runs"][0]["status"], "succeeded");
host.call("deleteRoutine", json!({"botId":bot,"id":id})).await;
- assert!(host.call("routines", json!({"botId":bot})).await["routines"].as_array().unwrap().is_empty());
+ assert_eq!(host.call("routines", json!({"botId":bot})).await["routines"].as_array().unwrap().len(), 0);
}
#[tokio::test]
@@ -481,5 +481,5 @@ async fn schedule_editor_preview_and_save_share_host_rules() {
.unwrap();
assert!(!response.status().is_success());
}
- assert!(host.call("routines", json!({"botId":bot})).await["runs"].as_array().unwrap().is_empty());
+ assert_eq!(host.call("routines", json!({"botId":bot})).await["runs"].as_array().unwrap().len(), 0);
}