MCPcopy Index your code
hub / github.com/codehamr/codehamr / runTurn

Function runTurn

internal/tui/tui_test.go:1186–1196  ·  view source on GitHub ↗

runTurn wires a model against handler, submits `text`, drains the command chain, and returns the Model. token, when non-empty, is installed on both the active profile and the live llm.Client so cloud auth headers travel as in production.

(t *testing.T, handler http.HandlerFunc, token, text string)

Source from the content-addressed store, hash-verified

1184// active profile and the live llm.Client so cloud auth headers travel as in
1185// production.
1186func runTurn(t *testing.T, handler http.HandlerFunc, token, text string) Model {
1187 t.Helper()
1188 m := newTestModel(t, handler)
1189 if token != "" {
1190 m.cfg.ActiveProfile().Key = token
1191 m.cli.Token = token
1192 }
1193 mm, cmd := m.submit(text, text, promptEntry{display: text})
1194 out, _ := drain(mm, cmd)
1195 return out.(Model)
1196}
1197
1198// budgetResponseHandler is a test LLM endpoint that answers with a single
1199// "ok" message plus the budget header, using OpenAI SSE format.

Calls 4

newTestModelFunction · 0.85
drainFunction · 0.85
ActiveProfileMethod · 0.80
submitMethod · 0.80

Tested by

no test coverage detected