()
| 802 | |
| 803 | #[test] |
| 804 | fn test_parse_pre_tool() { |
| 805 | let input = br#"{ |
| 806 | "session_id": "sess-123", |
| 807 | "tool_name": "exec_command", |
| 808 | "tool_use_id": "call-1", |
| 809 | "tool_input": {"cmd": "cargo test"} |
| 810 | }"#; |
| 811 | let event = make_hook() |
| 812 | .parse_event(HookType::PreToolUse, input) |
| 813 | .unwrap(); |
| 814 | assert_eq!(event.session_id, "sess-123"); |
| 815 | assert_eq!(event.event_type, HookType::PreToolUse); |
| 816 | assert_eq!(event.tool_name.as_deref(), Some("exec_command")); |
| 817 | assert_eq!(event.tool_use_id.as_deref(), Some("call-1")); |
| 818 | assert_eq!(event.raw_json.unwrap()["tool_input"]["cmd"], "cargo test"); |
| 819 | } |
| 820 | |
| 821 | #[test] |
| 822 | fn test_parse_pre_tool_accepts_tool_call_id_alias() { |
nothing calls this directly
no test coverage detected