()
| 616 | |
| 617 | #[test] |
| 618 | fn test_parse_stop_end_turn() { |
| 619 | let hook = make_hook(); |
| 620 | let input = br#"{ |
| 621 | "sessionId": "s1", |
| 622 | "reason": "end_turn", |
| 623 | "stopHookActive": false, |
| 624 | "lastAssistantMessage": "Done." |
| 625 | }"#; |
| 626 | let event = hook.parse_event(HookType::TurnEnd, input).unwrap(); |
| 627 | assert_eq!(event.session_id, "s1"); |
| 628 | assert_eq!(event.event_type, HookType::TurnEnd); |
| 629 | let raw = event.raw_json.unwrap(); |
| 630 | assert_eq!( |
| 631 | raw.get("finish_reason").and_then(Value::as_str), |
| 632 | Some("stop") |
| 633 | ); |
| 634 | assert_eq!( |
| 635 | raw.get("stop_hook_active").and_then(Value::as_bool), |
| 636 | Some(false) |
| 637 | ); |
| 638 | assert_eq!( |
| 639 | raw.get("last_assistant_message").and_then(Value::as_str), |
| 640 | Some("Done.") |
| 641 | ); |
| 642 | } |
| 643 | |
| 644 | #[test] |
| 645 | fn test_parse_stop_session_end_fire() { |
nothing calls this directly
no test coverage detected