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

Function TestToolCallFlushesStreamedContent

internal/tui/tui_test.go:2495–2511  ·  view source on GitHub ↗

TestToolCallFlushesStreamedContent: a tool-call event ends the content phase. Whatever streamed before it is rendered and committed *now*, so the user sees styled text *before* the inline tool-call status, not all at once at turn end.

(t *testing.T)

Source from the content-addressed store, hash-verified

2493 i = j
2494 break
2495 }
2496 }
2497 continue
2498 }
2499 b.WriteByte(s[i])
2500 }
2501 return b.String()
2502}
2503
2504// TestStreamContentShowsLiveInViewport: a mid-turn content event populates the
2505// streaming buffer, promotes phase thinking→streaming, and is visible in View()
2506// before any EventDone: the "tokens stream immediately" promise.
2507func TestStreamContentShowsLiveInViewport(t *testing.T) {
2508 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
2509 m.phase = phaseThinking
2510 out, _ := m.handleStream(llm.Event{Kind: llm.EventContent, Content: "hello world"})
2511 om := out.(Model)
2512 if om.phase != phaseStreaming {
2513 t.Fatalf("first content chunk should promote phase to streaming, got %v", om.phase)
2514 }

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected