feat(theming): add theme discovery with gruvbox assets

This commit is contained in:
MDietermann
2026-04-14 12:56:09 +02:00
parent 465d10a5ef
commit b628898c6d
7 changed files with 245 additions and 0 deletions

View 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)
}
}
}