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

Function TestSlashClearSurvivesBrokenConfig

internal/tui/tui_test.go:1001–1015  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
1001func 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
1017func TestSubmitStreamsUpToDone(t *testing.T) {
1018 m := newTestModel(t, func(w http.ResponseWriter, _ *http.Request) {

Callers

nothing calls this directly

Calls 2

newTestModelFunction · 0.85
runSlashMethod · 0.80

Tested by

no test coverage detected