()
| 612 | |
| 613 | #[test] |
| 614 | fn test_parse_post_tool_use() { |
| 615 | let hook = make_hook(); |
| 616 | let input = br#"{ |
| 617 | "sessionId": "s1", |
| 618 | "toolName": "search_replace", |
| 619 | "toolUseId": "tu-2", |
| 620 | "toolInput": {"target_file": "src/main.rs"}, |
| 621 | "toolResult": "ok" |
| 622 | }"#; |
| 623 | let event = hook.parse_event(HookType::PostToolUse, input).unwrap(); |
| 624 | assert_eq!(event.tool_name.as_deref(), Some("search_replace")); |
| 625 | assert_eq!(event.tool_use_id.as_deref(), Some("tu-2")); |
| 626 | let raw = event.raw_json.unwrap(); |
| 627 | assert_eq!(raw.get("tool_output").and_then(Value::as_str), Some("ok")); |
| 628 | assert_eq!(raw.get("status").and_then(Value::as_str), Some("completed")); |
| 629 | assert_eq!( |
| 630 | raw.get("file_path").and_then(Value::as_str), |
| 631 | Some("src/main.rs") |
| 632 | ); |
| 633 | assert_eq!(raw.get("provider").and_then(Value::as_str), Some("xai")); |
| 634 | } |
| 635 | |
| 636 | #[test] |
| 637 | fn test_parse_empty_input() { |
nothing calls this directly
no test coverage detected