package main import ( "os" "path/filepath" "testing" ) func TestConfigFilePathUsesXDGConfigDir(t *testing.T) { t.Setenv("HOME", t.TempDir()) t.Setenv("XDG_CONFIG_HOME", t.TempDir()) got, err := configFilePath() if err != nil { t.Fatal(err) } want := filepath.Join(os.Getenv("XDG_CONFIG_HOME"), "docspell-cli", "config.json") if got != want { t.Fatalf("expected %q, got %q", want, got) } }