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

Function TestHistoryPushesOnSubmit

internal/tui/tui_test.go:542–556  ·  view source on GitHub ↗

TestHistoryPushesOnSubmit: successful submit appends to promptHistory and resets the walker index to -1.

(t *testing.T)

Source from the content-addressed store, hash-verified

540// TestHistoryPushesOnSubmit: successful submit appends to promptHistory and
541// resets the walker index to -1.
542func TestHistoryPushesOnSubmit(t *testing.T) {
543 m := newTestModel(t, func(w http.ResponseWriter, _ *http.Request) {
544 fmt.Fprint(w, "data: "+`{"choices":[{"delta":{"content":"ok"}}]}`+"\n\n")
545 fmt.Fprint(w, "data: [DONE]\n\n")
546 })
547 m.histIdx = 2 // simulate "was navigating history"
548 mm, _ := m.submit("hello", "hello", promptEntry{display: "hello"})
549 final := mm.(Model)
550 if len(final.promptHistory) != 1 || final.promptHistory[0].display != "hello" {
551 t.Fatalf("promptHistory wrong: %+v", final.promptHistory)
552 }
553 if final.histIdx != -1 {
554 t.Fatalf("histIdx should reset to -1 after submit, got %d", final.histIdx)
555 }
556}
557
558// TestBackendLabelShowsActiveProfile: the label echoes the currently-active
559// profile name. Default Bootstrap ships one profile called "local". No

Callers

nothing calls this directly

Calls 2

newTestModelFunction · 0.85
submitMethod · 0.80

Tested by

no test coverage detected