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

Source from the content-addressed store, hash-verified

670
671 #[test]
672 fn test_parse_post_tool_use() {
673 let hook = make_hook();
674 let input = br#"{
675 "sessionId": "s1",
676 "toolName": "search_replace",
677 "toolUseId": "tu-2",
678 "toolInput": {"target_file": "src/main.rs"},
679 "toolResult": "ok"
680 }"#;
681 let event = hook.parse_event(HookType::PostToolUse, input).unwrap();
682 assert_eq!(event.tool_name.as_deref(), Some("search_replace"));
683 assert_eq!(event.tool_use_id.as_deref(), Some("tu-2"));
684 let raw = event.raw_json.unwrap();
685 assert_eq!(raw.get("tool_output").and_then(Value::as_str), Some("ok"));
686 assert_eq!(raw.get("status").and_then(Value::as_str), Some("completed"));
687 assert_eq!(
688 raw.get("file_path").and_then(Value::as_str),
689 Some("src/main.rs")
690 );
691 assert_eq!(raw.get("provider").and_then(Value::as_str), Some("xai"));
692 }
693
694 // Real payloads carrying both spellings of every field are covered in
695 // `tests/grok_real_payloads.rs`.

Callers

nothing calls this directly

Calls 3

make_hookFunction · 0.70
unwrapMethod · 0.45
parse_eventMethod · 0.45

Tested by

no test coverage detected