-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_tests.diff
More file actions
43 lines (43 loc) · 1.21 KB
/
patch_tests.diff
File metadata and controls
43 lines (43 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--- codex-rs/core/src/agentmemory/mod.rs
+++ codex-rs/core/src/agentmemory/mod.rs
@@ -118,3 +118,48 @@
Ok(())
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use serde_json::json;
+
+ #[test]
+ fn test_api_base_default() {
+ // Ensure env var is not set
+ std::env::remove_var("III_REST_PORT");
+ let adapter = AgentmemoryAdapter::new();
+ assert_eq!(adapter.api_base(), "http://localhost:3111");
+ }
+
+ #[test]
+ fn test_api_base_custom_port() {
+ std::env::set_var("III_REST_PORT", "4000");
+ let adapter = AgentmemoryAdapter::new();
+ assert_eq!(adapter.api_base(), "http://localhost:4000");
+ std::env::remove_var("III_REST_PORT");
+ }
+
+ #[test]
+ fn test_format_claude_parity_payload() {
+ let adapter = AgentmemoryAdapter::new();
+ let raw_payload = json!({
+ "session_id": "1234",
+ "turn_id": "turn-5",
+ "command": "echo hello"
+ });
+
+ let formatted = adapter.format_claude_parity_payload("PreToolUse", raw_payload.clone());
+
+ assert_eq!(formatted["event"], "PreToolUse");
+ assert_eq!(formatted["payload"], raw_payload);
+ }
+}