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

Function test_parse_all_events_roundtrip

atomic-agent/src/hooks/copilot.rs:889–916  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

887
888 #[test]
889 fn test_parse_all_events_roundtrip() {
890 let hook = make_hook();
891
892 let test_cases = vec![
893 (HookType::SessionStart, br#"{"session_id":"s1"}"#.as_slice()),
894 (HookType::SessionEnd, br#"{"session_id":"s1"}"#.as_slice()),
895 (
896 HookType::TurnStart,
897 br#"{"session_id":"s1","prompt":"fix bug"}"#.as_slice(),
898 ),
899 (
900 HookType::PreToolUse,
901 br#"{"session_id":"s1","toolName":"edit"}"#.as_slice(),
902 ),
903 (
904 HookType::PostToolUse,
905 br#"{"session_id":"s1","toolName":"bash","duration":500}"#.as_slice(),
906 ),
907 ];
908
909 for (hook_type, input) in test_cases {
910 let event = hook
911 .parse_event(hook_type, input)
912 .unwrap_or_else(|e| panic!("Failed to parse {:?}: {}", hook_type, e));
913 assert_eq!(event.session_id, "s1");
914 assert_eq!(event.event_type, hook_type);
915 }
916 }
917
918 #[test]
919 fn test_debug_impl() {

Callers

nothing calls this directly

Calls 2

make_hookFunction · 0.70
parse_eventMethod · 0.45

Tested by

no test coverage detected