MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestQueueWaitsForVerifyNudge

Function TestQueueWaitsForVerifyNudge

internal/tui/queue_test.go:214–239  ·  view source on GitHub ↗

TestQueueWaitsForVerifyNudge: a substantial clean finish triggers the verify re-grounding nudge, which continues the turn. The queued prompt must NOT fire then (the turn isn't ending); it stays queued until the turn truly ends.

(t *testing.T)

Source from the content-addressed store, hash-verified

212// re-grounding nudge, which continues the turn. The queued prompt must NOT fire
213// then (the turn isn't ending); it stays queued until the turn truly ends.
214func TestQueueWaitsForVerifyNudge(t *testing.T) {
215 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
216 m.installTurnContext()
217 m.phase = phaseStreaming
218 m.toolRounds = verifyNudgeMinRounds // substantial → verify nudge fires
219 m.stream = make(chan llm.Event)
220 m.history = []chmctx.Message{
221 {Role: chmctx.RoleUser, Content: "build it"},
222 {Role: chmctx.RoleAssistant, Content: "Done, all features built."},
223 }
224 m.queued = &queuedPrompt{send: "now deploy", echo: "now deploy"}
225
226 out, cmd := m.handleStreamClosed()
227 om := out.(Model)
228
229 if cmd == nil || !om.verifyNudged {
230 t.Fatal("a substantial clean finish must re-prompt via the verify nudge")
231 }
232 if om.queued == nil || om.queued.send != "now deploy" {
233 t.Fatalf("the queued prompt must wait through the verify re-prompt, got %+v", om.queued)
234 }
235 last := om.history[len(om.history)-1]
236 if last.Role != chmctx.RoleSystem {
237 t.Fatalf("the re-prompt must append the verify note, not the queued user msg, got %+v", last)
238 }
239}
240
241// TestUnqueueRestoresToTextarea: Backspace on an empty prompt while a turn runs
242// pulls the queued prompt back into the textarea and clears the slot, a

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
installTurnContextMethod · 0.80
handleStreamClosedMethod · 0.80

Tested by

no test coverage detected