TestHistoryPushesOnSubmit: successful submit appends to promptHistory and resets the walker index to -1.
(t *testing.T)
| 540 | // TestHistoryPushesOnSubmit: successful submit appends to promptHistory and |
| 541 | // resets the walker index to -1. |
| 542 | func 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 |
nothing calls this directly
no test coverage detected