MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_parse_pre_tool

Function test_parse_pre_tool

atomic-agent/src/hooks/codex.rs:804–819  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

802
803 #[test]
804 fn test_parse_pre_tool() {
805 let input = br#"{
806 "session_id": "sess-123",
807 "tool_name": "exec_command",
808 "tool_use_id": "call-1",
809 "tool_input": {"cmd": "cargo test"}
810 }"#;
811 let event = make_hook()
812 .parse_event(HookType::PreToolUse, input)
813 .unwrap();
814 assert_eq!(event.session_id, "sess-123");
815 assert_eq!(event.event_type, HookType::PreToolUse);
816 assert_eq!(event.tool_name.as_deref(), Some("exec_command"));
817 assert_eq!(event.tool_use_id.as_deref(), Some("call-1"));
818 assert_eq!(event.raw_json.unwrap()["tool_input"]["cmd"], "cargo test");
819 }
820
821 #[test]
822 fn test_parse_pre_tool_accepts_tool_call_id_alias() {

Callers

nothing calls this directly

Calls 3

make_hookFunction · 0.70
unwrapMethod · 0.45
parse_eventMethod · 0.45

Tested by

no test coverage detected