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

Function test_parse_post_tool_use

atomic-agent/src/hooks/grok.rs:614–634  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

612
613 #[test]
614 fn test_parse_post_tool_use() {
615 let hook = make_hook();
616 let input = br#"{
617 "sessionId": "s1",
618 "toolName": "search_replace",
619 "toolUseId": "tu-2",
620 "toolInput": {"target_file": "src/main.rs"},
621 "toolResult": "ok"
622 }"#;
623 let event = hook.parse_event(HookType::PostToolUse, input).unwrap();
624 assert_eq!(event.tool_name.as_deref(), Some("search_replace"));
625 assert_eq!(event.tool_use_id.as_deref(), Some("tu-2"));
626 let raw = event.raw_json.unwrap();
627 assert_eq!(raw.get("tool_output").and_then(Value::as_str), Some("ok"));
628 assert_eq!(raw.get("status").and_then(Value::as_str), Some("completed"));
629 assert_eq!(
630 raw.get("file_path").and_then(Value::as_str),
631 Some("src/main.rs")
632 );
633 assert_eq!(raw.get("provider").and_then(Value::as_str), Some("xai"));
634 }
635
636 #[test]
637 fn test_parse_empty_input() {

Callers

nothing calls this directly

Calls 3

make_hookFunction · 0.70
unwrapMethod · 0.45
parse_eventMethod · 0.45

Tested by

no test coverage detected