MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestViewHandlesZeroWidth

Function TestViewHandlesZeroWidth

internal/tui/tui_test.go:1380–1392  ·  view source on GitHub ↗

TestViewHandlesZeroWidth reproduces the "shrunk UI" startup flash: before WindowSizeMsg arrives, View must not panic or emit garbled layout.

(t *testing.T)

Source from the content-addressed store, hash-verified

1378
1379// TestStatusBarShowsBudgetFromHeaders: the pass segment renders whenever
1380// X-Budget-Remaining arrives: the header is the only signal, no profile gating.
1381// The percent is rounded to a whole number so it doesn't jitter on every token.
1382func TestStatusBarShowsBudgetFromHeaders(t *testing.T) {
1383 view := runTurn(t, budgetResponseHandler, "sk-test", "hi").View()
1384 if !strings.Contains(view, "73% pass") {
1385 t.Fatalf("status bar missing pass segment: %s", view)
1386 }
1387}
1388
1389// TestStatusBarOmitsBudgetWithoutHeaders: endpoint sends no budget header,
1390// no pass segment appears.
1391func TestStatusBarOmitsBudgetWithoutHeaders(t *testing.T) {
1392 view := runTurn(t, func(w http.ResponseWriter, _ *http.Request) {
1393 w.Header().Set("Content-Type", "text/event-stream")
1394 fmt.Fprint(w, "data: "+`{"choices":[{"delta":{"content":"ok"}}]}`+"\n\n")
1395 fmt.Fprint(w, "data: [DONE]\n\n")

Callers

nothing calls this directly

Calls 6

BootstrapFunction · 0.92
NewFunction · 0.92
ActiveProfileMethod · 0.80
NewFunction · 0.70
ViewMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected