TestQueueRestoredOnCtrlC: a Ctrl+C abort never fires the queued prompt (the user took back control); it returns the text to the textarea as an editable draft and clears the slot, so there's no idle "queued" box that would orphan-fire after the next turn.
(t *testing.T)
| 164 | // draft and clears the slot, so there's no idle "queued" box that would |
| 165 | // orphan-fire after the next turn. |
| 166 | func TestQueueRestoredOnCtrlC(t *testing.T) { |
| 167 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 168 | ctx, cancel := context.WithCancel(context.Background()) |
| 169 | m.turnCtx = ctx |
| 170 | m.cancel = cancel |
| 171 | m.phase = phaseThinking |
| 172 | m.queued = &queuedPrompt{send: "later task", echo: "later task"} |
| 173 | |
| 174 | out, _ := m.Update(tea.KeyMsg{Type: tea.KeyCtrlC}) |
| 175 | om := out.(Model) |
| 176 | |
| 177 | if om.phase.active() { |
| 178 | t.Fatalf("Ctrl+C must return to idle, got %v", om.phase) |
| 179 | } |
| 180 | if om.queued != nil { |
| 181 | t.Fatalf("Ctrl+C must clear the slot, got %+v", om.queued) |
| 182 | } |
| 183 | if om.ta.Value() != "later task" { |
| 184 | t.Fatalf("Ctrl+C must restore the queued text to the textarea, got %q", om.ta.Value()) |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | // TestQueueRestoreKeepsExistingDraft: if the user was typing a new prompt when |
| 189 | // they Ctrl+C, that draft wins; the queued prompt is dropped rather than |
nothing calls this directly
no test coverage detected