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

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

Callers

nothing calls this directly

Calls 2

newTestModelFunction · 0.85
submitMethod · 0.80

Tested by

no test coverage detected