Skip to content

Commit

Permalink
refacto test xdg
Browse files Browse the repository at this point in the history
  • Loading branch information
tutilus committed Sep 6, 2024
1 parent 9484f67 commit 08258d9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
runs-on: ${{ matrix.platform }}
env:
TERM: xterm-256color
XDG_CONFIG_HOME: /home/runner/.config
steps:
- name: Install Go
uses: actions/setup-go@v5
Expand Down
5 changes: 1 addition & 4 deletions internal/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,19 +522,16 @@ var _ = Describe("Cli", func() {
})
})

When("there is a config file in the XDG config directory", func() {
When("there is a config file in the XDG config default directory", func() {
It("should read the config file from disk", func() {
inputConfigHome, _ := homedir.Dir()
inputConfigHome += "/.config"
os.Setenv("XDG_CONFIG_HOME", inputConfigHome)
inputConfigPath := ""
depLocal.Fs.MkdirAll(inputConfigHome+"/ticker", 0755)
configFile := inputConfigHome + "/ticker/ticker.yaml"
depLocal.Fs.Create(configFile)
afero.WriteFile(depLocal.Fs, configFile, []byte("watchlist:\n - AMD"), 0644)
outputConfig, outputErr := GetConfig(depLocal, inputConfigPath, cli.Options{})
os.Unsetenv("XDG_CONFIG_HOME")

Expect(outputConfig.Watchlist).To(Equal([]string{"AMD"}))
Expect(outputErr).To(BeNil())
})
Expand Down

0 comments on commit 08258d9

Please sign in to comment.