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

Function test_parse_full_cline_payload

atomic-agent/src/hooks/cline.rs:1139–1165  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1137
1138 #[test]
1139 fn test_parse_full_cline_payload() {
1140 let hook = make_hook();
1141 let input = br#"{
1142 "taskId": "abc123",
1143 "hookName": "TaskStart",
1144 "clineVersion": "3.2.1",
1145 "timestamp": "1736654400000",
1146 "workspaceRoots": ["/path/to/project"],
1147 "userId": "user-42",
1148 "model": {"provider": "openrouter", "slug": "anthropic/claude-sonnet-4.5"},
1149 "taskStart": {"task": "Add authentication to the API"}
1150 }"#;
1151 let event = hook.parse_event(HookType::SessionStart, input).unwrap();
1152 assert_eq!(event.session_id, "abc123");
1153 assert_eq!(event.event_type, HookType::SessionStart);
1154 assert_eq!(
1155 event.prompt.as_deref(),
1156 Some("Add authentication to the API")
1157 );
1158 let raw = event.raw_json.unwrap();
1159 assert_eq!(raw["model_name"], "anthropic/claude-sonnet-4.5");
1160 assert_eq!(raw["vendor"], "openrouter");
1161 // Original fields preserved
1162 assert_eq!(raw["hookName"], "TaskStart");
1163 assert_eq!(raw["clineVersion"], "3.2.1");
1164 assert_eq!(raw["userId"], "user-42");
1165 }
1166
1167 #[test]
1168 fn test_debug_impl() {

Callers

nothing calls this directly

Calls 3

make_hookFunction · 0.70
unwrapMethod · 0.45
parse_eventMethod · 0.45

Tested by

no test coverage detected