feat(tui): add NvChadTheme field and ThemeByID helper

This commit is contained in:
MDietermann
2026-04-14 09:58:04 +02:00
parent adfc9232ac
commit e830e4dfda
2 changed files with 49 additions and 9 deletions

View File

@@ -70,3 +70,31 @@ func TestSelectedIDsOnlyReturnsChecked(t *testing.T) {
t.Fatalf("got %v", got)
}
}
func TestBuiltinThemesCarryNvChadName(t *testing.T) {
for _, th := range BuiltinThemes {
if th.NvChadTheme == "" {
t.Errorf("theme %q has empty NvChadTheme", th.ID)
}
}
}
func TestThemeByIDReturnsMatch(t *testing.T) {
got, ok := ThemeByID(BuiltinThemes, "dracula")
if !ok {
t.Fatal("dracula should exist")
}
if got.ID != "dracula" {
t.Fatalf("got id=%q", got.ID)
}
if got.NvChadTheme == "" {
t.Fatal("NvChadTheme empty")
}
}
func TestThemeByIDFallsBackWhenUnknown(t *testing.T) {
_, ok := ThemeByID(BuiltinThemes, "does-not-exist")
if ok {
t.Fatal("unknown id should report ok=false")
}
}