()
| 1053 | |
| 1054 | #[test] |
| 1055 | fn test_parse_all_events_roundtrip() { |
| 1056 | let hook = make_hook(); |
| 1057 | |
| 1058 | let test_cases: Vec<(HookType, &[u8])> = vec![ |
| 1059 | ( |
| 1060 | HookType::SessionStart, |
| 1061 | br#"{"taskId":"t1","taskStart":{"task":"start"}}"#, |
| 1062 | ), |
| 1063 | ( |
| 1064 | HookType::SessionEnd, |
| 1065 | br#"{"taskId":"t1","taskCancel":{"task":"cancelled"}}"#, |
| 1066 | ), |
| 1067 | ( |
| 1068 | HookType::TurnStart, |
| 1069 | br#"{"taskId":"t1","userPromptSubmit":{"prompt":"fix bug"}}"#, |
| 1070 | ), |
| 1071 | ( |
| 1072 | HookType::TurnEnd, |
| 1073 | br#"{"taskId":"t1","taskComplete":{"task":"done"}}"#, |
| 1074 | ), |
| 1075 | ( |
| 1076 | HookType::PreToolUse, |
| 1077 | br#"{"taskId":"t1","preToolUse":{"tool":"read_file"}}"#, |
| 1078 | ), |
| 1079 | ( |
| 1080 | HookType::PostToolUse, |
| 1081 | br#"{"taskId":"t1","postToolUse":{"tool":"write_to_file","durationMs":500}}"#, |
| 1082 | ), |
| 1083 | ]; |
| 1084 | |
| 1085 | for (hook_type, input) in test_cases { |
| 1086 | let event = hook |
| 1087 | .parse_event(hook_type, input) |
| 1088 | .unwrap_or_else(|e| panic!("Failed to parse {:?}: {}", hook_type, e)); |
| 1089 | assert_eq!(event.session_id, "t1"); |
| 1090 | assert_eq!(event.event_type, hook_type); |
| 1091 | } |
| 1092 | } |
| 1093 | |
| 1094 | // ── Model extraction tests ────────────────────────────────────── |
| 1095 |
nothing calls this directly
no test coverage detected