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

Function test_parse_pre_tool

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

Source from the content-addressed store, hash-verified

960
961 #[test]
962 fn test_parse_pre_tool() {
963 let input = br#"{
964 "session_id": "sess-123",
965 "tool_name": "exec_command",
966 "tool_use_id": "call-1",
967 "tool_input": {"cmd": "cargo test"}
968 }"#;
969 let event = make_hook()
970 .parse_event(HookType::PreToolUse, input)
971 .unwrap();
972 assert_eq!(event.session_id, "sess-123");
973 assert_eq!(event.event_type, HookType::PreToolUse);
974 assert_eq!(event.tool_name.as_deref(), Some("exec_command"));
975 assert_eq!(event.tool_use_id.as_deref(), Some("call-1"));
976 assert_eq!(event.raw_json.unwrap()["tool_input"]["cmd"], "cargo test");
977 }
978
979 #[test]
980 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