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