mirror of
https://github.com/bakito/adguardhome-sync.git
synced 2024-09-20 14:56:13 +08:00
5a3f2004bc
* Updateing file.go to load from default .adguardhome-sync.yaml file * Update file_test.go to load from default .adguardhome-sync.yaml file
33 lines
669 B
Go
33 lines
669 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/google/uuid"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("Config", func() {
|
|
var ()
|
|
BeforeEach(func() {
|
|
})
|
|
Context("configFilePath", func() {
|
|
It("should return the same value", func() {
|
|
path := uuid.NewString()
|
|
result, err := configFilePath(path)
|
|
|
|
Ω(err).ShouldNot(HaveOccurred())
|
|
Ω(result).Should(Equal(path))
|
|
})
|
|
It("should the file in HOME dir", func() {
|
|
home := os.Getenv("HOME")
|
|
result, err := configFilePath("")
|
|
|
|
Ω(err).ShouldNot(HaveOccurred())
|
|
Ω(result).Should(Equal(filepath.Join(home, "/.adguardhome-sync.yaml")))
|
|
})
|
|
})
|
|
})
|