MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestSaveAndLoad

Function TestSaveAndLoad

internal/config/config_test.go:32–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestSaveAndLoad(t *testing.T) {
33 dir := t.TempDir()
34
35 cfg := &Config{
36 Worktree: WorktreeConfig{
37 Setup: "npm install",
38 },
39 OnComplete: OnCompleteConfig{
40 Push: true,
41 CreatePR: true,
42 },
43 }
44
45 if err := Save(dir, cfg); err != nil {
46 t.Fatalf("Save failed: %v", err)
47 }
48
49 loaded, err := Load(dir)
50 if err != nil {
51 t.Fatalf("Load failed: %v", err)
52 }
53
54 if loaded.Worktree.Setup != "npm install" {
55 t.Errorf("expected setup %q, got %q", "npm install", loaded.Worktree.Setup)
56 }
57 if !loaded.OnComplete.Push {
58 t.Error("expected Push to be true")
59 }
60 if !loaded.OnComplete.CreatePR {
61 t.Error("expected CreatePR to be true")
62 }
63}
64
65func TestExists(t *testing.T) {
66 dir := t.TempDir()

Callers

nothing calls this directly

Calls 2

SaveFunction · 0.85
LoadFunction · 0.85

Tested by

no test coverage detected