Files
Archduino/internal/theming/theming_test.go

43 lines
908 B
Go

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