feat(config/m7-363): branding config field + defaults

This commit is contained in:
2026-05-03 17:14:59 -04:00
parent ec1b3a3397
commit cd50ffd77d
3 changed files with 75 additions and 0 deletions
+47
View File
@@ -151,3 +151,50 @@ func TestLibraryYAMLLoads(t *testing.T) {
t.Error("scan_on_startup = false")
}
}
func TestBrandingDefaults(t *testing.T) {
cfg := Default()
if cfg.Branding.AppName != "Minstrel" {
t.Errorf("AppName: got %q, want %q", cfg.Branding.AppName, "Minstrel")
}
if cfg.Branding.Description == "" {
t.Errorf("Description: empty after Default(); want default tagline")
}
}
func TestBrandingYAMLOverride(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "config.yaml")
content := []byte(`branding:
app_name: "Family Jukebox"
description: "Our home library."
`)
if err := os.WriteFile(path, content, 0o644); err != nil {
t.Fatal(err)
}
cfg, err := Load(path)
if err != nil {
t.Fatalf("Load: %v", err)
}
if cfg.Branding.AppName != "Family Jukebox" {
t.Errorf("AppName: got %q", cfg.Branding.AppName)
}
if cfg.Branding.Description != "Our home library." {
t.Errorf("Description: got %q", cfg.Branding.Description)
}
}
func TestBrandingEnvOverride(t *testing.T) {
t.Setenv("SMARTMUSIC_BRANDING_APP_NAME", "Office Music")
t.Setenv("SMARTMUSIC_BRANDING_DESCRIPTION", "Office tunes.")
cfg, err := Load("")
if err != nil {
t.Fatalf("Load: %v", err)
}
if cfg.Branding.AppName != "Office Music" {
t.Errorf("AppName: got %q", cfg.Branding.AppName)
}
if cfg.Branding.Description != "Office tunes." {
t.Errorf("Description: got %q", cfg.Branding.Description)
}
}