feat(theming): integrate NvChad chadrc rewrite into Apply
This commit is contained in:
@@ -177,4 +177,34 @@ func TestUnknownThemeFallsBackToFirst(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteChadrcWritesFile(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
t.Setenv("HOME", home)
|
||||
cfg := filepath.Join(home, ".config", "nvim")
|
||||
if err := os.MkdirAll(cfg, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := WriteChadrc("dracula"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := os.ReadFile(filepath.Join(cfg, "lua", "chadrc.lua"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(string(data), `theme = "dracula"`) {
|
||||
t.Fatalf("theme not applied: %s", data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteChadrcNoopWithoutConfigDir(t *testing.T) {
|
||||
home := t.TempDir()
|
||||
t.Setenv("HOME", home)
|
||||
if err := WriteChadrc("gruvbox"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(home, ".config", "nvim", "lua", "chadrc.lua")); !os.IsNotExist(err) {
|
||||
t.Fatal("chadrc should not be created on a bare system")
|
||||
}
|
||||
}
|
||||
|
||||
var _ module.Module = Module{}
|
||||
|
||||
Reference in New Issue
Block a user