Skip to content

Commit 8a69a10

Browse files
committed
fixed config tests with nil maps
1 parent 4013253 commit 8a69a10

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

service/config/config_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func Test_applyFileTargets(t *testing.T) {
2626
Name: "name",
2727
RepoURL: "../test.local",
2828
Up: []string{"echo", "hello world"},
29+
Env: map[string]string{},
2930
},
3031
}, false},
3132
{"variable", `
@@ -37,9 +38,9 @@ func Test_applyFileTargets(t *testing.T) {
3738
3839
console.log("done!");
3940
`, task.Targets{
40-
{Name: "1", RepoURL: "https://github.com/Southclaws/project1", Up: []string{"sleep"}},
41-
{Name: "2", RepoURL: "https://github.com/Southclaws/project2", Up: []string{"sleep"}},
42-
{Name: "3", RepoURL: "https://github.com/Southclaws/project3", Up: []string{"sleep"}},
41+
{Name: "1", RepoURL: "https://github.com/Southclaws/project1", Up: []string{"sleep"}, Env: map[string]string{}},
42+
{Name: "2", RepoURL: "https://github.com/Southclaws/project2", Up: []string{"sleep"}, Env: map[string]string{}},
43+
{Name: "3", RepoURL: "https://github.com/Southclaws/project3", Up: []string{"sleep"}, Env: map[string]string{}},
4344
}, false},
4445
{"envmap", `
4546
var url = "https://github.com/Southclaws/";
@@ -65,8 +66,8 @@ func Test_applyFileTargets(t *testing.T) {
6566
`, task.Targets{
6667
{Name: "name", RepoURL: "../test.local", Up: []string{"sleep"}, Env: map[string]string{"GLOBAL": "readme", "LOCAL": "hi"}},
6768
}, false},
68-
{"badtype", `T({name: "name", url: "../test.local", up: 1.23})`, task.Targets{{}}, true},
69-
{"missingkey", `T({name: "name", url: "../test.local"})`, task.Targets{{}}, true},
69+
{"badtype", `T({name: "name", url: "../test.local", up: 1.23})`, task.Targets{}, true},
70+
{"missingkey", `T({name: "name", url: "../test.local"})`, task.Targets{}, true},
7071
{"env", `console.log(ENV["TEST_ENV_KEY"])`, task.Targets{}, false},
7172
{"hostname", `console.log(HOSTNAME)`, task.Targets{}, false},
7273
}
@@ -81,7 +82,7 @@ func Test_applyFileTargets(t *testing.T) {
8182

8283
os.Setenv("TEST_ENV_KEY", "an environment variable inside the JS vm")
8384

84-
err := cb.construct()
85+
err := cb.construct("host")
8586
if tt.wantErr {
8687
assert.Error(t, err)
8788
return

0 commit comments

Comments
 (0)