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

Function TestSetActivePersists

internal/config/config_test.go:410–431  ·  view source on GitHub ↗

TestSetActivePersists: SetActive flips Active and writes config.yaml.

(t *testing.T)

Source from the content-addressed store, hash-verified

408
409// TestSetActivePersists: SetActive flips Active and writes config.yaml.
410func TestSetActivePersists(t *testing.T) {
411 dir := t.TempDir()
412 cfg, _, err := Bootstrap(dir)
413 if err != nil {
414 t.Fatal(err)
415 }
416 // add a second profile so SetActive has somewhere to go
417 cfg.Models["other"] = &Profile{LLM: "m", URL: "http://x", ContextSize: 1}
418 if err := cfg.SetActive("other"); err != nil {
419 t.Fatal(err)
420 }
421 if cfg.Active != "other" {
422 t.Fatalf("Active = %q, want other", cfg.Active)
423 }
424 reloaded, _, err := Bootstrap(dir)
425 if err != nil {
426 t.Fatal(err)
427 }
428 if reloaded.Active != "other" {
429 t.Fatal("Active did not persist")
430 }
431}
432
433// TestSetActiveRejectsUnknown: SetActive returns an error for an unknown name.
434func TestSetActiveRejectsUnknown(t *testing.T) {

Callers

nothing calls this directly

Calls 2

BootstrapFunction · 0.85
SetActiveMethod · 0.80

Tested by

no test coverage detected