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

Function TestQueueSecondEnterAppends

internal/tui/queue_test.go:63–79  ·  view source on GitHub ↗

TestQueueSecondEnterAppends: a second mid-turn Enter appends (newline-joined) to the existing slot, so a multi-part instruction builds up in one queued prompt that fires as a single turn.

(t *testing.T)

Source from the content-addressed store, hash-verified

61// to the existing slot, so a multi-part instruction builds up in one queued
62// prompt that fires as a single turn.
63func TestQueueSecondEnterAppends(t *testing.T) {
64 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
65 m.phase = phaseThinking
66
67 m.ta.SetValue("run the tests")
68 o1, _ := m.Update(tea.KeyMsg{Type: tea.KeyEnter})
69 m1 := o1.(Model)
70
71 m1.ta.SetValue("then commit if green")
72 o2, _ := m1.Update(tea.KeyMsg{Type: tea.KeyEnter})
73 m2 := o2.(Model)
74
75 want := "run the tests\nthen commit if green"
76 if m2.queued == nil || m2.queued.send != want {
77 t.Fatalf("second Enter must append newline-joined, got %+v", m2.queued)
78 }
79}
80
81// TestQueueRefusesSlashMix: a slash command never newline-joins with a queued
82// prompt, in either order. Joined slash-first, the whole slot would fire as ONE

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
SetValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected