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

Function TestProbeBudgetExhaustedUpdatesStatusBar

internal/tui/tui_test.go:1301–1317  ·  view source on GitHub ↗

TestProbeBudgetExhaustedUpdatesStatusBar: a 402 probe carries a BudgetStatus{Set:true, Remaining:0} snapshot. handleProbe must apply it to m.budget so the bar paints "0% pass" now, not after the first chat call 402s.

(t *testing.T)

Source from the content-addressed store, hash-verified

1299// TestStaleProbeForSameProfileDoesNotOverwriteFreshOutcome: two probes for the
1300// SAME profile can be in flight (startup probe + a re-activation); the profile
1301// name alone can't tell them apart, so staleness is keyed on the client
1302// pointer (rebuildClient swaps it per re-activation). A hung old probe's
1303// failure landing after the fresh probe's success must neither flip connected
1304// nor print a contradictory "⚠ probe" banner after the "✓ active" line.
1305func TestStaleProbeForSameProfileDoesNotOverwriteFreshOutcome(t *testing.T) {
1306 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
1307 m.cfg.Active = "local"
1308 staleCli := m.cli
1309 m.rebuildClient() // re-activation swapped the client; staleCli's probe is now superseded
1310 m.connected = true
1311
1312 out, _ := m.handleProbe(probeMsg{profile: "local", cli: staleCli, err: cloud.ErrUnauthorized})
1313 final := out.(Model)
1314 if !final.connected {
1315 t.Fatal("stale same-profile probe failure must not flip connected")
1316 }
1317 if got := stripANSI(final.scroll.String()); strings.Contains(got, "⚠ probe") {
1318 t.Fatalf("stale same-profile probe must not print a failure banner:\n%s", got)
1319 }
1320}

Callers

nothing calls this directly

Calls 2

newTestModelFunction · 0.85
handleProbeMethod · 0.80

Tested by

no test coverage detected