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

Function TestUnqueueRestoresToTextarea

internal/tui/queue_test.go:244–258  ·  view source on GitHub ↗

TestUnqueueRestoresToTextarea: Backspace on an empty prompt while a turn runs pulls the queued prompt back into the textarea and clears the slot, a reversible way to edit or drop it.

(t *testing.T)

Source from the content-addressed store, hash-verified

242// TestUnqueueRestoresToTextarea: Backspace on an empty prompt while a turn runs
243// pulls the queued prompt back into the textarea and clears the slot, a
244// reversible way to edit or drop it.
245func TestUnqueueRestoresToTextarea(t *testing.T) {
246 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
247 m.phase = phaseThinking
248 m.queued = &queuedPrompt{send: "hello there", echo: "hello there"}
249
250 out, _ := m.Update(tea.KeyMsg{Type: tea.KeyBackspace})
251 om := out.(Model)
252
253 if om.ta.Value() != "hello there" {
254 t.Fatalf("Backspace must restore the queued text, got %q", om.ta.Value())
255 }
256 if om.queued != nil {
257 t.Fatalf("unqueue must clear the slot, got %+v", om.queued)
258 }
259}
260
261// TestUnqueueOnlyWhenTextareaEmpty: with a draft already in the textarea,

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
ValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected