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

Function TestParseLineOpenCode_text

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

Source from the content-addressed store, hash-verified

61}
62
63func TestParseLineOpenCode_text(t *testing.T) {
64 line := `{"type":"text","timestamp":1767036064268,"sessionID":"ses_494719016ffe85dkDMj0FPRbHK","part":{"id":"prt_b6b8e8ff2002mxSx9LtvAlf8Ng","sessionID":"ses_494719016ffe85dkDMj0FPRbHK","messageID":"msg_b6b8e8627001yM4qKJCXdC7W1L","type":"text","text":"hello\n","time":{"start":1767036064265,"end":1767036064265}}}`
65 ev := ParseLineOpenCode(line)
66 if ev == nil {
67 t.Fatal("expected event, got nil")
68 }
69 if ev.Type != EventAssistantText {
70 t.Errorf("expected EventAssistantText, got %v", ev.Type)
71 }
72 if ev.Text != "hello\n" {
73 t.Errorf("expected Text hello\\n, got %q", ev.Text)
74 }
75}
76
77func TestParseLineOpenCode_stepFinishStop(t *testing.T) {
78 line := `{"type":"step_finish","timestamp":1767036064273,"sessionID":"ses_494719016ffe85dkDMj0FPRbHK","part":{"id":"prt_b6b8e9209001ojZ4ECN1geZISm","sessionID":"ses_494719016ffe85dkDMj0FPRbHK","messageID":"msg_b6b8e8627001yM4qKJCXdC7W1L","type":"step-finish","reason":"stop","snapshot":"09dd05d11a4ac013136c1df10932efc0ad9116e8","cost":0.001,"tokens":{"input":671,"output":8,"reasoning":0,"cache":{"read":21415,"write":0}}}}`

Callers

nothing calls this directly

Calls 1

ParseLineOpenCodeFunction · 0.85

Tested by

no test coverage detected