package tui_test import ( "testing" "git.tukangketik.id/swanadiva/hostkeeper/pkg/tui" ) func TestGetTheme(t *testing.T) { // Test getting existing themes tests := []struct { name string expected string }{ {"dark", "dark"}, {"light", "light"}, {"dracula", "dracula"}, } for _, tt := range tests { theme := tui.GetTheme(tt.name) if theme.Name != tt.expected { t.Errorf("GetTheme(%q) = %q, want %q", tt.name, theme.Name, tt.expected) } } // Test getting non-existing theme defaults to dark theme := tui.GetTheme("nonexistent") if theme.Name != "dark" { t.Errorf("GetTheme(nonexistent) = %q, want %q", theme.Name, "dark") } } func TestSetTheme(t *testing.T) { // Set theme to light tui.SetTheme("light") active := tui.GetActiveTheme() if active.Name != "light" { t.Errorf("After SetTheme(light), GetActiveTheme() = %q, want %q", active.Name, "light") } // Set theme back to dark tui.SetTheme("dark") active = tui.GetActiveTheme() if active.Name != "dark" { t.Errorf("After SetTheme(dark), GetActiveTheme() = %q, want %q", active.Name, "dark") } } func TestGetActiveTheme(t *testing.T) { // Default should be dark active := tui.GetActiveTheme() if active.Name != "dark" { t.Errorf("GetActiveTheme() = %q, want %q", active.Name, "dark") } } func TestThemeRegistry(t *testing.T) { // Test that all themes are registered expectedThemes := []string{"dark", "light", "dracula"} for _, name := range expectedThemes { if _, ok := tui.Themes[name]; !ok { t.Errorf("Theme %q not found in Themes map", name) } } // Test theme count if len(tui.Themes) != 3 { t.Errorf("Themes map has %d entries, want 3", len(tui.Themes)) } }