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

Function TestEventDoneFlushesStreamingThroughGlamour

internal/tui/tui_test.go:2478–2490  ·  view source on GitHub ↗

TestEventDoneFlushesStreamingThroughGlamour: EventDone moves raw streamed text into the committed scroll via the Markdown renderer and empties the streaming buffer. After Done, scroll contains the rendered block and the streaming buffer is empty.

(t *testing.T)

Source from the content-addressed store, hash-verified

2476
2477// TestStreamContentShowsLiveInViewport: a mid-turn content event populates the
2478// streaming buffer, promotes phase thinking→streaming, and is visible in View()
2479// before any EventDone: the "tokens stream immediately" promise.
2480func TestStreamContentShowsLiveInViewport(t *testing.T) {
2481 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
2482 m.phase = phaseThinking
2483 out, _ := m.handleStream(llm.Event{Kind: llm.EventContent, Content: "hello world"})
2484 om := out.(Model)
2485 if om.phase != phaseStreaming {
2486 t.Fatalf("first content chunk should promote phase to streaming, got %v", om.phase)
2487 }
2488 if om.streaming.String() != "hello world" {
2489 t.Fatalf("streaming buffer should contain raw content, got %q", om.streaming.String())
2490 }
2491 if om.scroll.Len() != 0 {
2492 t.Fatalf("scroll should still be empty before flush, got %q", om.scroll.String())
2493 }

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