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

Function test_parse_post_tool

atomic-agent/src/hooks/cline.rs:846–867  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

844
845 #[test]
846 fn test_parse_post_tool() {
847 let hook = make_hook();
848 let input = br#"{
849 "taskId": "tool-4",
850 "hookName": "PostToolUse",
851 "postToolUse": {
852 "tool": "execute_command",
853 "parameters": {"command": "cargo test"},
854 "result": "All tests passed",
855 "success": true,
856 "durationMs": 2500
857 }
858 }"#;
859 let event = hook.parse_event(HookType::PostToolUse, input).unwrap();
860 assert_eq!(event.session_id, "tool-4");
861 assert_eq!(event.event_type, HookType::PostToolUse);
862 assert_eq!(event.tool_name.as_deref(), Some("execute_command"));
863 // Check duration and result stored in raw_json
864 let raw = event.raw_json.unwrap();
865 assert_eq!(raw["duration_ms"], 2500);
866 assert_eq!(raw["tool_result"], "All tests passed");
867 }
868
869 #[test]
870 fn test_parse_post_tool_snake_case_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