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 m.phase = phaseThinking // a tool only round starts here, before any content
1000 out, _ := m.handleStream(llm.Event{Kind: llm.EventToolArgs, Content: strings.Repeat("x", 40)})
1001 m = out.(Model)
1002 if m.phase != phaseStreaming {
1003 t.Fatalf("EventToolArgs should flip thinking→generating, phase=%v", m.phase)
1004 }
1005 if m.streamingEstimate != 10 { // 40 chars / 4
1006 t.Fatalf("EventToolArgs should bump the estimate by len/4, got %d", m.streamingEstimate)
1007 }
1008}
1009
1010// TestBuildToolsExposesExactlyFourTools pins the tool roster: bash, read_file,
1011// write_file, edit_file, in that order, with no loop/control tool. Order is
1012// part of the contract: the model sees the tools in the payload in this sequence.
1013func TestBuildToolsExposesExactlyFourTools(t *testing.T) {
1014 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
1015 got := m.buildTools()
1016 want := []string{
1017 tools.BashName,
1018 tools.ReadFileName,

Callers

nothing calls this directly

Calls 2

newTestModelFunction · 0.85
runSlashMethod · 0.80

Tested by

no test coverage detected