-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathoption_test.go
61 lines (48 loc) · 1.03 KB
/
option_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package config_test
import (
"testing"
"github.com/ankorstore/yokai/config"
"github.com/stretchr/testify/assert"
)
func TestDefaultConfigOptions(t *testing.T) {
opts := config.DefaultConfigOptions()
assert.Equal(t, "config", opts.FileName)
assert.Equal(
t,
[]string{
".",
"./config",
"./configs",
},
opts.FilePaths,
)
}
func TestDefaultConfigOptionsWithKO(t *testing.T) {
t.Setenv("KO_DATA_PATH", "/var/run/ko")
opts := config.DefaultConfigOptions()
assert.Equal(t, "config", opts.FileName)
assert.Equal(
t,
[]string{
".",
"./config",
"./configs",
"/var/run/ko",
"/var/run/ko/config",
"/var/run/ko/configs",
},
opts.FilePaths,
)
}
func TestWithFileName(t *testing.T) {
option := config.WithFileName("test")
opts := &config.Options{}
option(opts)
assert.Equal(t, "test", opts.FileName)
}
func TestWithFilePaths(t *testing.T) {
option := config.WithFilePaths("path1", "path2")
opts := &config.Options{}
option(opts)
assert.Equal(t, []string{"path1", "path2"}, opts.FilePaths)
}