feat(theming): add theme discovery with gruvbox assets
This commit is contained in:
42
internal/theming/theming_test.go
Normal file
42
internal/theming/theming_test.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package theming
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestListDiscoversThemes(t *testing.T) {
|
||||
themes := List()
|
||||
if len(themes) == 0 {
|
||||
t.Fatal("no themes discovered")
|
||||
}
|
||||
for _, th := range themes {
|
||||
if th.ID == "" || th.DisplayName == "" || th.NvChadTheme == "" {
|
||||
t.Errorf("incomplete theme: %+v", th)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetKnownThemeReturnsMatch(t *testing.T) {
|
||||
got, ok := Get("gruvbox")
|
||||
if !ok {
|
||||
t.Fatal("gruvbox should exist")
|
||||
}
|
||||
if got.ID != "gruvbox" || got.DisplayName == "" || got.NvChadTheme != "gruvbox" {
|
||||
t.Fatalf("got %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetUnknownThemeReturnsFalse(t *testing.T) {
|
||||
if _, ok := Get("does-not-exist"); ok {
|
||||
t.Fatal("bogus id should return ok=false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestListIsSortedByID(t *testing.T) {
|
||||
themes := List()
|
||||
for i := 1; i < len(themes); i++ {
|
||||
if themes[i].ID < themes[i-1].ID {
|
||||
t.Fatalf("not sorted: %s before %s", themes[i-1].ID, themes[i].ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user