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:561–585  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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