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

Function TestHamrpassNoArgsShowsExplainerWhenUnset

internal/tui/tui_test.go:2910–2936  ·  view source on GitHub ↗

TestHamrpassNoArgsShowsExplainerWhenUnset: `/hamrpass` with no key set prints the guided block, including the unset status line and the purchase URL. No active-profile change.

(t *testing.T)

Source from the content-addressed store, hash-verified

2908 w.Header().Set("Content-Type", "text/event-stream")
2909 round++
2910 fmt.Fprintf(w, "data: %s\n\n", `{"type":"response.completed","response":{"usage":{"output_tokens":1}}}`)
2911 }
2912
2913 m := newTestModel(t, handler)
2914 final := drainFinal(t, m, "build it")
2915
2916 if round != 2 {
2917 t.Fatalf("latch must bound re-prompts to one (want 2 requests total, got %d)", round)
2918 }
2919 scroll := stripANSI(final.scroll.String())
2920 if !strings.Contains(scroll, "dropped the call") {
2921 t.Fatalf("a persistently-empty turn must surface a diagnostic, not die silently:\n%s", scroll)
2922 }
2923 if final.phase != phaseIdle {
2924 t.Fatalf("turn must end idle, phase=%v", final.phase)
2925 }
2926}
2927
2928// TestEmptyReplyNudgeReArmsAfterProgress pins the galaxy1 fix: once an empty
2929// reply has nudged this turn, a round that issues a real tool call is genuine
2930// progress and must rearm the latch, so a LATER transient empty on the same
2931// long turn earns its own reprompt instead of hitting the leak and die branch.
2932// A flaky stream that drops the occasional call must not abandon a half built
2933// file. Two CONSECUTIVE empties (no tool call between) still terminate: that
2934// path has pending=0 and so never reaches the rearm.
2935func TestEmptyReplyNudgeReArmsAfterProgress(t *testing.T) {
2936 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
2937 m.installTurnContext()
2938 m.phase = phaseStreaming
2939 m.emptyNudged = true // a prior empty already nudged this turn

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
stripANSIFunction · 0.85
runSlashMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected