MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_parse_stop_end_turn

Function test_parse_stop_end_turn

atomic-agent/src/hooks/grok.rs:618–642  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 3

make_hookFunction · 0.70
unwrapMethod · 0.45
parse_eventMethod · 0.45

Tested by

no test coverage detected