package cli import ( "testing" "git.eeqj.de/sneak/vaultik/internal/config" "gopkg.in/yaml.v3" ) // TestDefaultConfigTemplateParses ensures the init template is valid YAML // that unmarshals into the Config struct with the expected snapshots. func TestDefaultConfigTemplateParses(t *testing.T) { var cfg config.Config if err := yaml.Unmarshal([]byte(defaultConfigTemplate), &cfg); err != nil { t.Fatalf("default config template is not valid YAML: %v", err) } if len(cfg.AgeRecipients) != 1 { t.Errorf("expected 1 placeholder age recipient, got %d", len(cfg.AgeRecipients)) } home, ok := cfg.Snapshots["home"] if !ok { t.Fatal("expected 'home' snapshot in default config") } if len(home.Paths) == 0 { t.Error("home snapshot should have at least one path") } if len(home.Exclude) == 0 { t.Error("home snapshot should have exclude patterns") } apps, ok := cfg.Snapshots["apps"] if !ok { t.Fatal("expected 'apps' snapshot in default config") } if len(apps.Paths) != 1 || apps.Paths[0] != "/Applications" { t.Errorf("apps snapshot should back up /Applications, got %v", apps.Paths) } if len(apps.Exclude) == 0 { t.Error("apps snapshot should have exclude patterns") } }