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: show the value when a memory check finds something

leepokaid25b8235197d
diff --git a/host/crates/memory/src/dream.rs b/host/crates/memory/src/dream.rs
index 83c06bcd..a02fa289 100644
--- a/host/crates/memory/src/dream.rs
+++ b/host/crates/memory/src/dream.rs
@@ -588,7 +588,7 @@ mod tests {
let raw = "Sure!\n```json\n{\"add\": [{\"text\": \"Likes tea\", \"quote\": \"I like tea a lot\", \"message\": \"m1\"}]}\n```";
let plan = parse(raw).unwrap();
assert_eq!(plan.add[0].text, "Likes tea");
- assert!(plan.archive.is_empty());
+ assert_eq!(plan.archive, [] as [Archive; 0]);
assert_eq!(parse("no json here"), None);
}
diff --git a/host/crates/memory/src/opening.rs b/host/crates/memory/src/opening.rs
index 2e6082b7..3904405f 100644
--- a/host/crates/memory/src/opening.rs
+++ b/host/crates/memory/src/opening.rs
@@ -105,7 +105,7 @@ mod tests {
assert!(!text.contains("Old fact") && !text.contains("Other bot's"));
let alone = load(&conn, "a", false).unwrap();
- assert!(alone.yours.is_empty());
+ assert_eq!(alone.yours, [] as [Entry; 0]);
assert!(!alone.render().contains("shared with"));
}
}
diff --git a/host/crates/memory/src/store.rs b/host/crates/memory/src/store.rs
index dca1ec37..ec4ba34d 100644
--- a/host/crates/memory/src/store.rs
+++ b/host/crates/memory/src/store.rs
@@ -495,7 +495,7 @@ mod tests {
add(&conn, Writer::User, new(Some("b"), "Peanut farm visit"), 4, 4).unwrap();
let found: Vec<String> = search(&conn, "a", "PEANUT", 10).unwrap().into_iter().map(|e| e.text).collect();
assert_eq!(found, ["Allergic to Peanuts", "Uses peanut butter in recipes"]);
- assert!(search(&conn, "a", "100%", 10).unwrap().is_empty());
+ assert_eq!(search(&conn, "a", "100%", 10).unwrap(), [] as [Entry; 0]);
}
#[test]
@@ -515,7 +515,7 @@ mod tests {
add(&conn, Writer::User, new(Some("a"), "Bot fact"), 2, 2).unwrap();
assert_eq!(forget_layer(&conn, Some("a")).unwrap().len(), 1);
assert_eq!(layer(&conn, None).unwrap().len(), 1);
- assert!(layer(&conn, Some("a")).unwrap().is_empty());
+ assert_eq!(layer(&conn, Some("a")).unwrap(), [] as [Entry; 0]);
assert_eq!(changed_since(&conn, 0).unwrap().len(), 1);
}
}
diff --git a/host/tests/memory_e2e.rs b/host/tests/memory_e2e.rs
index 5a1c00ab..140f1437 100644
--- a/host/tests/memory_e2e.rs
+++ b/host/tests/memory_e2e.rs
@@ -162,7 +162,7 @@ async fn moves_old_memory_once_and_keeps_the_layers_apart() {
host.call("forgetMemory", json!({"botId": b, "id": own})).await;
host.call("clearMemory", json!({"botId": a, "shared": true})).await;
let view = host.memory(&b).await;
- assert!(view["yours"]["entries"].as_array().unwrap().is_empty());
+ assert_eq!(view["yours"]["entries"], json!([]));
assert!(!view.to_string().contains("Reviews PRs"));
}
@@ -181,7 +181,7 @@ async fn bots_write_memory_by_their_permission() {
assert_eq!(texts(&host.memory(&auto).await["bot"], "active"), ["Prefers short replies"]);
host.call("undoMemory", json!({"entryId": card["id"]})).await;
assert_eq!(host.card(&auto).await["data"]["memory"]["status"], "undone");
- assert!(host.memory(&auto).await["bot"]["entries"].as_array().unwrap().is_empty());
+ assert_eq!(host.memory(&auto).await["bot"]["entries"], json!([]));
let again = host.tool_refused(&auto, "remember", json!({"text": "prefers short replies."})).await;
assert!(again.contains("deleted this memory before"), "{again}");
@@ -198,7 +198,7 @@ async fn bots_write_memory_by_their_permission() {
// A bot that asks first puts a card in the chat; nothing is written until the user approves.
let pending = host.tool(&ask, "remember", json!({"text": "Works from home on Mondays"})).await;
assert_eq!(pending["status"], "waitingForUser");
- assert!(host.memory(&ask).await["bot"]["entries"].as_array().unwrap().is_empty());
+ assert_eq!(host.memory(&ask).await["bot"]["entries"], json!([]));
let card = host.card(&ask).await;
assert_eq!(card["data"]["memory"]["status"], "pending");
host.call("answerMemory", json!({"entryId": card["id"], "accept": true})).await;
@@ -260,6 +260,6 @@ async fn dreaming_keeps_only_what_the_user_typed_and_can_be_undone() {
let dream = view["dreams"][0]["id"].as_i64().unwrap();
host.call("undoDream", json!({"botId": bot, "id": dream})).await;
let view = host.memory(&bot).await;
- assert!(view["bot"]["entries"].as_array().unwrap().is_empty());
+ assert_eq!(view["bot"]["entries"], json!([]));
assert_eq!(view["dreams"][0]["undone"], true);
}