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:615–635  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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