refactor: move V1 code into v1/ subdirectory
- git mv cmd/ internal/ pkg/ test/ go.mod go.sum Makefile build.sh docs/ v1/ - Create v1/README.md with V1 documentation - Update root README for V1 + V2 structure - V1 still builds (cd v1 && go build ./cmd/hostkeeper) and 105 tests pass - Root is now clean for V2 development
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
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))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user