feat(theming): apply updates overlay theme_overrides.__active
This commit is contained in:
@@ -79,3 +79,41 @@ func TestApplyUnknownThemeErrors(t *testing.T) {
|
||||
t.Fatal("want error on unknown theme")
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyUpdatesOverlayActive(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
t.Setenv("HOME", home)
|
||||
if err := Apply(config.Config{}, "gruvbox"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := os.ReadFile(filepath.Join(home, ".config", "archduino", "overlay.yaml"))
|
||||
if err != nil {
|
||||
t.Fatalf("overlay missing: %v", err)
|
||||
}
|
||||
if !strings.Contains(string(data), "__active: gruvbox") {
|
||||
t.Fatalf("overlay missing active theme: %s", data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyPreservesOtherOverlayKeys(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
t.Setenv("HOME", home)
|
||||
op := filepath.Join(home, ".config", "archduino", "overlay.yaml")
|
||||
if err := os.MkdirAll(filepath.Dir(op), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(op, []byte("version: 1\nextra_packages:\n - foo\n"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := Apply(config.Config{}, "gruvbox"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, _ := os.ReadFile(op)
|
||||
if !strings.Contains(string(data), "- foo") {
|
||||
t.Fatalf("extra_packages lost: %s", data)
|
||||
}
|
||||
if !strings.Contains(string(data), "__active: gruvbox") {
|
||||
t.Fatalf("active theme missing after preserve: %s", data)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user