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

Function test_parse_pre_tool

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

Source from the content-addressed store, hash-verified

974
975 #[test]
976 fn test_parse_pre_tool() {
977 let input = br#"{
978 "session_id": "sess-123",
979 "tool_name": "exec_command",
980 "tool_use_id": "call-1",
981 "tool_input": {"cmd": "cargo test"}
982 }"#;
983 let event = make_hook()
984 .parse_event(HookType::PreToolUse, input)
985 .unwrap();
986 assert_eq!(event.session_id, "sess-123");
987 assert_eq!(event.event_type, HookType::PreToolUse);
988 assert_eq!(event.tool_name.as_deref(), Some("exec_command"));
989 assert_eq!(event.tool_use_id.as_deref(), Some("call-1"));
990 assert_eq!(event.raw_json.unwrap()["tool_input"]["cmd"], "cargo test");
991 }
992
993 #[test]
994 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