Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit90d6f29

Browse files
mirkoCrobumirkoCrobu
mirkoCrobu
authored and
mirkoCrobu
committed
fix texdata structure
1 parentce322aa commit90d6f29

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

‎internal/store/store_test.go‎

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ import (
77

88
"github.com/arduino/go-paths-helper"
99
"github.com/stretchr/testify/require"
10+
11+
"github.com/arduino/arduino-app-cli/internal/orchestrator/config"
1012
)
1113

1214
constvalidBrickID="arduino:arduino_cloud"
1315

14-
funcsetupTestStore() (*StaticStore,string) {
15-
baseDir:=paths.New("testdata").String()
16+
funcsetupTestStore(t*testing.T) (*StaticStore,string) {
17+
cfg,err:=config.NewFromEnv()
18+
require.NoError(t,err)
19+
baseDir:=paths.New("testdata","assets",cfg.RunnerVersion).String()
1620
returnNewStaticStore(baseDir),baseDir
1721
}
1822

1923
funcTestGetBrickReadmeFromID(t*testing.T) {
20-
21-
store,baseDir:=setupTestStore()
24+
store,baseDir:=setupTestStore(t)
2225
namespace,brickName,_:=parseBrickID(validBrickID)
2326
expectedReadmePath:=filepath.Join(baseDir,"docs",namespace,brickName,"README.md")
2427
expectedContent,err:=os.ReadFile(expectedReadmePath)
@@ -57,15 +60,10 @@ func TestGetBrickReadmeFromID(t *testing.T) {
5760

5861
for_,tc:=rangetestCases {
5962
t.Run(tc.name,func(t*testing.T) {
60-
6163
content,err:=store.GetBrickReadmeFromID(tc.brickID)
62-
6364
iftc.wantErr {
64-
6565
require.Error(t,err,"should have returned an error")
66-
6766
iftc.wantErrIs!=nil {
68-
6967
require.ErrorIs(t,err,tc.wantErrIs,"error type mismatch")
7068
}
7169
iftc.wantErrMsg!="" {
@@ -80,11 +78,8 @@ func TestGetBrickReadmeFromID(t *testing.T) {
8078
}
8179

8280
funcTestGetBrickComposeFilePathFromID(t*testing.T) {
83-
84-
store,baseDir:=setupTestStore()
85-
81+
store,baseDir:=setupTestStore(t)
8682
namespace,brickName,_:=parseBrickID(validBrickID)
87-
8883
expectedPathString:=filepath.Join(baseDir,"compose",namespace,brickName,"brick_compose.yaml")
8984

9085
testCases:= []struct {
@@ -112,7 +107,6 @@ func TestGetBrickComposeFilePathFromID(t *testing.T) {
112107
for_,tc:=rangetestCases {
113108
t.Run(tc.name,func(t*testing.T) {
114109
path,err:=store.GetBrickComposeFilePathFromID(tc.brickID)
115-
116110
iftc.wantErr {
117111
require.Error(t,err,"function was expected to return an error")
118112
require.Nil(t,path,"path was expected to be nil")
@@ -127,8 +121,7 @@ func TestGetBrickComposeFilePathFromID(t *testing.T) {
127121
}
128122

129123
funcTestGetBrickCodeExamplesPathFromID(t*testing.T) {
130-
store,_:=setupTestStore()
131-
124+
store,_:=setupTestStore(t)
132125
constexpectedEntryCount=2
133126

134127
testCases:= []struct {
@@ -169,7 +162,6 @@ func TestGetBrickCodeExamplesPathFromID(t *testing.T) {
169162
}else {
170163
require.NoError(t,err,"should not have returned an error")
171164
}
172-
173165
iftc.wantNilList {
174166
require.Nil(t,pathList,"pathList should be nil")
175167
}else {
File renamed without changes.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp