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

Function TestQueueExpandsChipsOnFire

internal/tui/queue_test.go:316–338  ·  view source on GitHub ↗

TestQueueExpandsChipsOnFire: a chip-bearing paste queued mid-turn keeps its expanded content for the LLM (send) while the box echo stays collapsed, the same Value()/DisplayValue() split submit uses for a typed prompt.

(t *testing.T)

Source from the content-addressed store, hash-verified

314
315// TestQueueExpandsChipsOnFire: a chip-bearing paste queued mid-turn keeps its
316// expanded content for the LLM (send) while the box echo stays collapsed, the
317// same Value()/DisplayValue() split submit uses for a typed prompt.
318func TestQueueExpandsChipsOnFire(t *testing.T) {
319 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
320 m.phase = phaseThinking
321
322 big := strings.Repeat("payload line\n", 6) // ≥5 lines → collapses into a chip
323 out, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(big), Paste: true})
324 m1 := out.(Model)
325 if !strings.Contains(m1.ta.DisplayValue(), "Pasted text") {
326 t.Fatalf("precondition: a large paste must chip, display=%q", m1.ta.DisplayValue())
327 }
328
329 o2, _ := m1.Update(tea.KeyMsg{Type: tea.KeyEnter})
330 m2 := o2.(Model)
331 if m2.queued == nil {
332 t.Fatal("the paste must queue mid-turn")
333 }
334 if !strings.Contains(m2.queued.send, "payload line") {
335 t.Fatalf("send must carry the EXPANDED paste, got %q", m2.queued.send)
336 }
337 if !strings.Contains(m2.queued.echo, "Pasted text") {
338 t.Fatalf("echo must stay COLLAPSED, got %q", m2.queued.echo)
339 }
340}
341

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
DisplayValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected