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

Function TestBackendLabelReflectsConnectedState

internal/tui/tui_test.go:1420–1433  ·  view source on GitHub ↗

TestBackendLabelReflectsConnectedState asserts the backend label renders differently when connected vs not: the user's at-a-glance "are we talking to a server?" signal. Disconnected appends a `!` marker so the distinction survives on colour-stripped terminals.

(t *testing.T)

Source from the content-addressed store, hash-verified

1418
1419// TestStatusBarShowsSpinnerWhenWaiting verifies the micro-animation text
1420// appears in the bottom bar while a request is in flight, and disappears
1421// when not.
1422func TestStatusBarShowsSpinnerWhenWaiting(t *testing.T) {
1423 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
1424 if strings.Contains(m.renderStatusBar(), "thinking") {
1425 t.Fatal("idle status bar must not show thinking indicator")
1426 }
1427 m.phase = phaseThinking
1428 if !strings.Contains(m.renderStatusBar(), "thinking") {
1429 t.Fatalf("thinking status bar must show thinking indicator: %q", m.renderStatusBar())
1430 }
1431 m.phase = phaseStreaming
1432 if !strings.Contains(m.renderStatusBar(), "generating") {
1433 t.Fatalf("streaming status bar must show generating indicator: %q", m.renderStatusBar())
1434 }
1435 m.phase = phaseRunning
1436 if !strings.Contains(m.renderStatusBar(), "running") {

Callers

nothing calls this directly

Calls 3

BootstrapFunction · 0.92
backendLabelFunction · 0.85
stripANSIFunction · 0.85

Tested by

no test coverage detected