@@ -3,19 +3,22 @@ package cfg_test
3
3
import (
4
4
"errors"
5
5
"fmt"
6
+ "os"
6
7
"path/filepath"
8
+ "testing/fstest"
7
9
8
10
. "github.com/onsi/ginkgo/v2" //nolint:revive // foo
9
11
. "github.com/onsi/gomega" //nolint:revive // foo
10
- "github.com/spf13/viper"
11
- "go.uber.org/mock/gomock"
12
-
13
12
"github.com/snivilised/cobrass/src/assistant/mocks"
14
13
"github.com/snivilised/extendio/xfs/storage"
15
- "github.com/snivilised/li18ngo "
14
+ _ "github.com/snivilised/pants "
16
15
"github.com/snivilised/pixa/src/app/cfg"
17
16
"github.com/snivilised/pixa/src/app/proxy/common"
18
17
"github.com/snivilised/pixa/src/internal/helpers"
18
+ lab "github.com/snivilised/pixa/src/internal/laboratory"
19
+ "github.com/snivilised/traverse/lfs"
20
+ "github.com/spf13/viper"
21
+ "go.uber.org/mock/gomock"
19
22
)
20
23
21
24
var (
@@ -63,22 +66,32 @@ var _ = Describe("ConfigRunner", Ordered, func() {
63
66
var (
64
67
repo string
65
68
configPath string
66
- vfs storage.VirtualFS
69
+ vfsL storage.VirtualFS
70
+ FS lfs.TraverseFS
67
71
ctrl * gomock.Controller
68
72
mock * mocks.MockViperConfig
69
73
)
70
74
71
75
BeforeAll (func () {
72
- Expect (li18ngo .Use ()).To (Succeed ())
76
+ repo = helpers .Repo ("" )
77
+ Expect (lab .UseI18n (lab .Path (repo , "test/data/l10n" ))).To (Succeed ())
78
+ _ = FS
73
79
})
74
80
75
81
BeforeEach (func () {
76
82
viper .Reset ()
77
- vfs = storage .UseMemFS ()
83
+ vfsL = storage .UseMemFS ()
84
+ FS = & lab.TestTraverseFS {
85
+ MapFS : fstest.MapFS {
86
+ home : & fstest.MapFile {
87
+ Mode : os .ModeDir ,
88
+ },
89
+ },
90
+ }
78
91
ctrl = gomock .NewController (GinkgoT ())
79
92
mock = mocks .NewMockViperConfig (ctrl )
80
- repo = helpers . Repo ( "" )
81
- configPath = helpers .Path (repo , "test/data/configuration" )
93
+
94
+ configPath = lab .Path (repo , "test/data/configuration" )
82
95
})
83
96
84
97
AfterEach (func () {
@@ -107,7 +120,7 @@ var _ = Describe("ConfigRunner", Ordered, func() {
107
120
mock .EXPECT ().InConfig (gomock .Any ()).AnyTimes ()
108
121
mock .EXPECT ().GetString (gomock .Any ()).AnyTimes ()
109
122
110
- runner , err := cfg .New (& ci , sourceID , common .Definitions .Pixa .AppName , vfs )
123
+ runner , err := cfg .New (& ci , sourceID , common .Definitions .Pixa .AppName , FS , vfsL )
111
124
if entry .created != nil {
112
125
entry .created (entry , runner )
113
126
}
@@ -192,7 +205,7 @@ var _ = Describe("ConfigRunner", Ordered, func() {
192
205
path := filepath .Join (runner .DefaultPath (), name )
193
206
content := []byte (cfg .GetDefaultConfigContent ())
194
207
195
- _ = vfs .WriteFile (path , content , common .Permissions .Write )
208
+ _ = vfsL .WriteFile (path , content , common .Permissions .Write )
196
209
},
197
210
assert : func (_ * runnerTE , runner common.ConfigRunner , err error ) {
198
211
Expect (err ).Error ().To (BeNil ())
0 commit comments