()
| 974 | |
| 975 | #[test] |
| 976 | fn test_parse_pre_tool() { |
| 977 | let input = br#"{ |
| 978 | "session_id": "sess-123", |
| 979 | "tool_name": "exec_command", |
| 980 | "tool_use_id": "call-1", |
| 981 | "tool_input": {"cmd": "cargo test"} |
| 982 | }"#; |
| 983 | let event = make_hook() |
| 984 | .parse_event(HookType::PreToolUse, input) |
| 985 | .unwrap(); |
| 986 | assert_eq!(event.session_id, "sess-123"); |
| 987 | assert_eq!(event.event_type, HookType::PreToolUse); |
| 988 | assert_eq!(event.tool_name.as_deref(), Some("exec_command")); |
| 989 | assert_eq!(event.tool_use_id.as_deref(), Some("call-1")); |
| 990 | assert_eq!(event.raw_json.unwrap()["tool_input"]["cmd"], "cargo test"); |
| 991 | } |
| 992 | |
| 993 | #[test] |
| 994 | fn test_parse_pre_tool_accepts_tool_call_id_alias() { |
nothing calls this directly
no test coverage detected