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

Function TestStatusBarShowsSpinnerWhenWaiting

internal/tui/tui_test.go:1397–1414  ·  view source on GitHub ↗

TestStatusBarShowsSpinnerWhenWaiting verifies the micro-animation text appears in the bottom bar while a request is in flight, and disappears when not.

(t *testing.T)

Source from the content-addressed store, hash-verified

1395 fmt.Fprint(w, "data: "+`{"choices":[{"delta":{"content":"ok"}}]}`+"\n\n")
1396 fmt.Fprint(w, "data: [DONE]\n\n")
1397 }, "", "hi").View()
1398 if strings.Contains(view, "pass") {
1399 t.Fatalf("without headers the status bar must not show pass segment: %s", view)
1400 }
1401}
1402
1403// TestViewHandlesZeroWidth reproduces the "shrunk UI" startup flash: before
1404// WindowSizeMsg arrives, View must not panic or emit garbled layout.
1405func TestViewHandlesZeroWidth(t *testing.T) {
1406 cfg, _, _ := config.Bootstrap(t.TempDir())
1407 m := New(cfg, llm.New("http://x", cfg.ActiveProfile().LLM, ""), t.TempDir(), "test")
1408 m.width = 0 // simulate no WindowSizeMsg yet
1409 if got := m.View(); got != "" {
1410 t.Fatalf("zero-width view should be empty, got %q", got)
1411 }
1412 // After a real WindowSizeMsg the full frame should render.
1413 sized, _ := m.Update(tea.WindowSizeMsg{Width: 80, Height: 24})
1414 if sized.(Model).View() == "" {
1415 t.Fatal("sized view should not be empty")
1416 }
1417}

Callers

nothing calls this directly

Calls 2

newTestModelFunction · 0.85
renderStatusBarMethod · 0.80

Tested by

no test coverage detected