Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(json-rpc): remove obsolete WhatsApp tools e2e test

Steven Enamakel9bf0a995f502
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index 8660efa13a..86d213126e 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -9340,147 +9340,6 @@ async fn voice_cloud_transcribe_registered_e2e() {
rpc_join.abort();
}
-/// End-to-end coverage for the WhatsApp agent tool wrappers (issue #1341)
-/// after the store's relocation to the Tauri shell.
-///
-/// The SQLite store now lives shell-side; the core tools reach it over the
-/// in-process native request bus. This test stands in for the shell by
-/// registering canned native handlers, then verifies that:
-///
-/// 1. Each read-only tool dispatches over the bus and forwards the handler's
-/// typed rows, tagging every response with `"provider": "whatsapp"`.
-/// 2. `list_messages` still requires `chat_id`.
-/// 3. Tool metadata (names/descriptions) is intact.
-#[tokio::test(flavor = "multi_thread")]
-async fn whatsapp_data_agent_tools_e2e_1341() {
- use openhuman_core::core::bus::BUS;
- use openhuman_core::openhuman::channels::whatsapp_data::methods;
- use openhuman_core::openhuman::channels::whatsapp_data::types::{
- ListChatsRequest, ListMessagesRequest, SearchMessagesRequest, WhatsAppChat, WhatsAppMessage,
- };
- use openhuman_core::openhuman::tools::traits::Tool;
- use openhuman_core::openhuman::tools::{
- WhatsAppDataListChatsTool, WhatsAppDataListMessagesTool, WhatsAppDataSearchMessagesTool,
- };
-
- fn sample_chat(chat_id: &str) -> WhatsAppChat {
- WhatsAppChat {
- chat_id: chat_id.to_string(),
- display_name: "Alice".to_string(),
- is_group: false,
- account_id: "[email protected]".to_string(),
- last_message_ts: 1_700_000_000,
- message_count: 2,
- updated_at: 1_700_000_000,
- }
- }
- fn sample_msg(body: &str) -> WhatsAppMessage {
- WhatsAppMessage {
- message_id: "m1".to_string(),
- chat_id: "[email protected]".to_string(),
- sender: "Alice".to_string(),
- sender_jid: Some("[email protected]".to_string()),
- from_me: false,
- body: body.to_string(),
- timestamp: 1_700_000_000,
- message_type: Some("chat".to_string()),
- account_id: "[email protected]".to_string(),
- source: "cdp-dom".to_string(),
- }
- }
-
- // Stand in for the shell store: register canned native handlers.
- BUS.native()
- .register::<ListChatsRequest, Vec<WhatsAppChat>, _, _>(
- methods::LIST_CHATS,
- |_req| async move { Ok(vec![sample_chat("[email protected]"), sample_chat("[email protected]")]) },
- );
- BUS.native()
- .register::<ListMessagesRequest, Vec<WhatsAppMessage>, _, _>(
- methods::LIST_MESSAGES,
- |_req| async move { Ok(vec![sample_msg("Send the umbrella report by Friday")]) },
- );
- BUS.native()
- .register::<SearchMessagesRequest, Vec<WhatsAppMessage>, _, _>(
- methods::SEARCH_MESSAGES,
- |req| async move {
- if req.query.to_lowercase().contains("umbrella") {
- Ok(vec![sample_msg("Send the umbrella report by Friday")])
- } else {
- Ok(vec![])
- }
- },
- );
-
- fn parse_tool_output(result: openhuman_core::openhuman::skills::types::ToolResult) -> Value {
- assert!(!result.is_error, "tool returned error: {result:?}");
- serde_json::from_str(&result.output()).expect("tool output is valid JSON")
- }
-
- // list_chats — forwards handler rows, provider tag set.
- let chats_body = parse_tool_output(
- WhatsAppDataListChatsTool
- .execute(json!({ "account_id": "[email protected]" }))
- .await
- .expect("list_chats execute"),
- );
- assert_eq!(chats_body["provider"], "whatsapp");
- assert_eq!(chats_body["count"], 2);
-
- // list_messages — chat_id required, rows forwarded.
- let alice_body = parse_tool_output(
- WhatsAppDataListMessagesTool
- .execute(json!({ "chat_id": "[email protected]" }))
- .await
- .expect("list_messages execute"),
- );
- assert_eq!(alice_body["provider"], "whatsapp");
- assert_eq!(alice_body["count"], 1);
- assert!(alice_body["messages"][0]["body"]
- .as_str()
- .unwrap_or_default()
- .contains("umbrella report"));
-
- let missing_chat = WhatsAppDataListMessagesTool
- .execute(json!({}))
- .await
- .expect_err("expected missing chat_id error");
- assert!(missing_chat
- .to_string()
- .contains("whatsapp_data_list_messages"));
-
- // search_messages — hit + empty envelope shape.
- let search_body = parse_tool_output(
- WhatsAppDataSearchMessagesTool
- .execute(json!({ "query": "umbrella" }))
- .await
- .expect("search_messages execute"),
- );
- assert_eq!(search_body["provider"], "whatsapp");
- assert_eq!(search_body["count"], 1);
-
- let empty_body = parse_tool_output(
- WhatsAppDataSearchMessagesTool
- .execute(json!({ "query": "no-such-token-anywhere" }))
- .await
- .expect("search_messages empty execute"),
- );
- assert_eq!(empty_body["provider"], "whatsapp");
- assert_eq!(empty_body["count"], 0);
-
- // Tool metadata reachable for downstream wiring.
- assert_eq!(WhatsAppDataListChatsTool.name(), "whatsapp_data_list_chats");
- assert_eq!(
- WhatsAppDataListMessagesTool.name(),
- "whatsapp_data_list_messages"
- );
- assert_eq!(
- WhatsAppDataSearchMessagesTool.name(),
- "whatsapp_data_search_messages"
- );
- assert!(WhatsAppDataListChatsTool.description().contains("WhatsApp"));
-}
-
// ── MCP Clients lifecycle ─────────────────────────────────────────────────────
//
// Tests the install → installed_list → uninstall flow over real JSON-RPC.