()
| 558 | |
| 559 | #[test] |
| 560 | fn test_parse_stop_end_turn() { |
| 561 | let hook = make_hook(); |
| 562 | let input = br#"{ |
| 563 | "sessionId": "s1", |
| 564 | "reason": "end_turn", |
| 565 | "stopHookActive": false, |
| 566 | "lastAssistantMessage": "Done." |
| 567 | }"#; |
| 568 | let event = hook.parse_event(HookType::TurnEnd, input).unwrap(); |
| 569 | assert_eq!(event.session_id, "s1"); |
| 570 | assert_eq!(event.event_type, HookType::TurnEnd); |
| 571 | let raw = event.raw_json.unwrap(); |
| 572 | assert_eq!( |
| 573 | raw.get("finish_reason").and_then(Value::as_str), |
| 574 | Some("stop") |
| 575 | ); |
| 576 | assert_eq!( |
| 577 | raw.get("stop_hook_active").and_then(Value::as_bool), |
| 578 | Some(false) |
| 579 | ); |
| 580 | assert_eq!( |
| 581 | raw.get("last_assistant_message").and_then(Value::as_str), |
| 582 | Some("Done.") |
| 583 | ); |
| 584 | } |
| 585 | |
| 586 | #[test] |
| 587 | fn test_parse_stop_session_end_fire() { |
nothing calls this directly
no test coverage detected