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

Function TestSettingsOverlay_LoadFromConfig

internal/tui/settings_test.go:10–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestSettingsOverlay_LoadFromConfig(t *testing.T) {
11 s := NewSettingsOverlay()
12 cfg := &config.Config{
13 Worktree: config.WorktreeConfig{
14 Setup: "npm install",
15 },
16 OnComplete: config.OnCompleteConfig{
17 Push: true,
18 CreatePR: false,
19 },
20 }
21 s.LoadFromConfig(cfg)
22
23 if len(s.items) != 3 {
24 t.Fatalf("expected 3 items, got %d", len(s.items))
25 }
26 if s.items[0].Key != "worktree.setup" || s.items[0].StringVal != "npm install" {
27 t.Errorf("worktree.setup item: got key=%s val=%s", s.items[0].Key, s.items[0].StringVal)
28 }
29 if s.items[1].Key != "onComplete.push" || !s.items[1].BoolVal {
30 t.Errorf("onComplete.push item: got key=%s val=%v", s.items[1].Key, s.items[1].BoolVal)
31 }
32 if s.items[2].Key != "onComplete.createPR" || s.items[2].BoolVal {
33 t.Errorf("onComplete.createPR item: got key=%s val=%v", s.items[2].Key, s.items[2].BoolVal)
34 }
35 if s.selectedIndex != 0 {
36 t.Errorf("expected selectedIndex=0, got %d", s.selectedIndex)
37 }
38}
39
40func TestSettingsOverlay_ApplyToConfig(t *testing.T) {
41 s := NewSettingsOverlay()

Callers

nothing calls this directly

Calls 2

LoadFromConfigMethod · 0.95
NewSettingsOverlayFunction · 0.85

Tested by

no test coverage detected