MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestParseLineOpenCode_error

Function TestParseLineOpenCode_error

internal/loop/opencode_parser_test.go:96–111  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestParseLineOpenCode_error(t *testing.T) {
97 line := `{"type":"error","timestamp":1767036065000,"sessionID":"ses_494719016ffe85dkDMj0FPRbHK","error":{"name":"APIError","data":{"message":"Rate limit exceeded","statusCode":429,"isRetryable":true}}}`
98 ev := ParseLineOpenCode(line)
99 if ev == nil {
100 t.Fatal("expected event, got nil")
101 }
102 if ev.Type != EventError {
103 t.Errorf("expected EventError, got %v", ev.Type)
104 }
105 if ev.Err == nil {
106 t.Fatal("expected Err set")
107 }
108 if ev.Err.Error() != "Rate limit exceeded" {
109 t.Errorf("unexpected Err: %v", ev.Err)
110 }
111}
112
113func TestParseLineOpenCode_emptyOrInvalid_returnsNil(t *testing.T) {
114 tests := []string{"", " ", "not json", "{}", `{"type":"unknown"}`}

Callers

nothing calls this directly

Calls 1

ParseLineOpenCodeFunction · 0.85

Tested by

no test coverage detected