()
| 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() { |
nothing calls this directly
no test coverage detected