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