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

Function TestQueueRestoreKeepsExistingDraft

internal/tui/queue_test.go:191–209  ·  view source on GitHub ↗

TestQueueRestoreKeepsExistingDraft: if the user was typing a new prompt when they Ctrl+C, that draft wins; the queued prompt is dropped rather than clobbering the in-progress text.

(t *testing.T)

Source from the content-addressed store, hash-verified

189// they Ctrl+C, that draft wins; the queued prompt is dropped rather than
190// clobbering the in-progress text.
191func TestQueueRestoreKeepsExistingDraft(t *testing.T) {
192 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
193 ctx, cancel := context.WithCancel(context.Background())
194 m.turnCtx = ctx
195 m.cancel = cancel
196 m.phase = phaseThinking
197 m.queued = &queuedPrompt{send: "queued one", echo: "queued one"}
198 m.ta.SetValue("a fresh draft")
199
200 out, _ := m.Update(tea.KeyMsg{Type: tea.KeyCtrlC})
201 om := out.(Model)
202
203 if om.ta.Value() != "a fresh draft" {
204 t.Fatalf("an in-progress draft must survive Ctrl+C, got %q", om.ta.Value())
205 }
206 if om.queued != nil {
207 t.Fatalf("the queued slot must clear on abort, got %+v", om.queued)
208 }
209}
210
211// TestQueueWaitsForVerifyNudge: a substantial clean finish triggers the verify
212// re-grounding nudge, which continues the turn. The queued prompt must NOT fire

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
SetValueMethod · 0.80
ValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected