()
| 960 | |
| 961 | #[test] |
| 962 | fn test_parse_pre_tool() { |
| 963 | let input = br#"{ |
| 964 | "session_id": "sess-123", |
| 965 | "tool_name": "exec_command", |
| 966 | "tool_use_id": "call-1", |
| 967 | "tool_input": {"cmd": "cargo test"} |
| 968 | }"#; |
| 969 | let event = make_hook() |
| 970 | .parse_event(HookType::PreToolUse, input) |
| 971 | .unwrap(); |
| 972 | assert_eq!(event.session_id, "sess-123"); |
| 973 | assert_eq!(event.event_type, HookType::PreToolUse); |
| 974 | assert_eq!(event.tool_name.as_deref(), Some("exec_command")); |
| 975 | assert_eq!(event.tool_use_id.as_deref(), Some("call-1")); |
| 976 | assert_eq!(event.raw_json.unwrap()["tool_input"]["cmd"], "cargo test"); |
| 977 | } |
| 978 | |
| 979 | #[test] |
| 980 | fn test_parse_pre_tool_accepts_tool_call_id_alias() { |
nothing calls this directly
no test coverage detected