MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestEventErrorPreservesStreamedText

Function TestEventErrorPreservesStreamedText

internal/tui/tui_test.go:2713–2731  ·  view source on GitHub ↗

TestEventErrorPreservesStreamedText: a stream error mid-content flushes the partial text before appending the error line, same principle as cancel, user keeps the context they were reading.

(t *testing.T)

Source from the content-addressed store, hash-verified

2711 stale := toolResultMsg{
2712 Msg: chmctx.Message{Role: chmctx.RoleTool, ToolCallID: "stale", Content: "ghost"},
2713 turnCtx: ctxStale,
2714 }
2715 out, cmd := m.Update(stale)
2716 om := out.(Model)
2717 if len(om.history) != beforeLen {
2718 t.Fatalf("stale tool result entered live history: %+v", om.history)
2719 }
2720 if om.stream != beforeStream {
2721 t.Fatal("stale tool result triggered a fresh startChat - live stream replaced")
2722 }
2723 if cmd != nil {
2724 t.Fatalf("stale tool result returned a Cmd; should be no-op: %T", cmd)
2725 }
2726}
2727
2728// TestRunToolCallHonorsBashTimeoutBeyondLegacyCap: bash's own timeout is the only
2729// ceiling: runToolCall must not wrap the parent context in a shorter cap. Runs a
2730// fast `echo` with a 1800s tool-arg timeout and asserts it completes normally.
2731func TestRunToolCallHonorsBashTimeoutBeyondLegacyCap(t *testing.T) {
2732 parent := context.Background() // no outer deadline
2733 cmd := runToolCall(parent, chmctx.ToolCall{
2734 ID: "t-cap",

Callers

nothing calls this directly

Calls 5

newTestModelFunction · 0.85
stripANSIFunction · 0.85
handleStreamMethod · 0.80
StringMethod · 0.80
activeMethod · 0.80

Tested by

no test coverage detected