Files
yellowjacket/backend/favorites/config_test.go
T
yonlu e1a95e65a9 fix(quick-13): resolve lint issues in main source files
- Fix errcheck for db.Close() in testhelper.go
- Fix errcheck, nlreturn, wsl, gofumpt issues in genevents/main.go
- Fix gofumpt and wsl issues in library.go
2026-03-05 14:07:50 -05:00

51 lines
921 B
Go

package favorites
import (
"testing"
)
func TestFavoritesConfig_Validate_ValidIconStyles(t *testing.T) {
t.Parallel()
tests := []struct {
name string
style IconStyle
}{
{"heart", IconHeart},
{"star", IconStar},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
c := &Config{IconStyle: tt.style}
if err := c.Validate(); err != nil {
t.Errorf("Validate() returned unexpected error: %v", err)
}
})
}
}
func TestFavoritesConfig_Validate_InvalidIconStyle(t *testing.T) {
t.Parallel()
c := &Config{IconStyle: "diamond"}
err := c.Validate()
if err == nil {
t.Fatal("Validate() expected error for unknown icon style, got nil")
}
}
func TestFavoritesConfig_ApplyDefaults(t *testing.T) {
t.Parallel()
c := &Config{}
c.ApplyDefaults()
if c.IconStyle != DefaultIconStyle {
t.Errorf("IconStyle = %q, want %q", c.IconStyle, DefaultIconStyle)
}
}