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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

make_hookFunction · 0.70
unwrapMethod · 0.45
parse_eventMethod · 0.45

Tested by

no test coverage detected