TestSlashClearSurvivesBrokenConfig: with config.yaml unparseable, /clear must still wipe history. The reload warning gets wiped with the rest of scrollback (fine, it reappears on the next non-/clear slash); the reset still works.
(t *testing.T)
| 999 | // still wipe history. The reload warning gets wiped with the rest of scrollback |
| 1000 | // (fine, it reappears on the next non-/clear slash); the reset still works. |
| 1001 | func TestSlashClearSurvivesBrokenConfig(t *testing.T) { |
| 1002 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 1003 | m.history = append(m.history, |
| 1004 | chmctx.Message{Role: chmctx.RoleUser, Content: "hi"}, |
| 1005 | chmctx.Message{Role: chmctx.RoleAssistant, Content: "hey"}, |
| 1006 | ) |
| 1007 | if err := os.WriteFile(filepath.Join(m.cfg.Dir, "config.yaml"), |
| 1008 | []byte("active: [unterminated\nmodels: {{"), 0o600); err != nil { |
| 1009 | t.Fatal(err) |
| 1010 | } |
| 1011 | out, _ := m.runSlash("/clear") |
| 1012 | if len(out.(Model).history) != 0 { |
| 1013 | t.Fatal("/clear must still drop history with broken config") |
| 1014 | } |
| 1015 | } |
| 1016 | |
| 1017 | func TestSubmitStreamsUpToDone(t *testing.T) { |
| 1018 | m := newTestModel(t, func(w http.ResponseWriter, _ *http.Request) { |
nothing calls this directly
no test coverage detected