-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test to cover the default name
With help from @phamann.
- Loading branch information
Showing
1 changed file
with
16 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ func TestInit(t *testing.T) { | |
stdin string | ||
wantError string | ||
wantOutput []string | ||
manifestIncludes string | ||
manifestIncludes []string | ||
}{ | ||
{ | ||
name: "no token", | ||
|
@@ -120,7 +120,7 @@ func TestInit(t *testing.T) { | |
"Fetching package template...", | ||
"Updating package manifest...", | ||
}, | ||
manifestIncludes: `name = "test"`, | ||
manifestIncludes: []string{`name = "test"`}, | ||
}, | ||
{ | ||
name: "with service", | ||
|
@@ -140,7 +140,7 @@ func TestInit(t *testing.T) { | |
"Fetching package template...", | ||
"Updating package manifest...", | ||
}, | ||
manifestIncludes: `name = "test"`, | ||
manifestIncludes: []string{`name = "test"`}, | ||
}, | ||
{ | ||
name: "with description", | ||
|
@@ -158,7 +158,7 @@ func TestInit(t *testing.T) { | |
"Fetching package template...", | ||
"Updating package manifest...", | ||
}, | ||
manifestIncludes: `description = "test"`, | ||
manifestIncludes: []string{`description = "test"`}, | ||
}, | ||
{ | ||
name: "with author", | ||
|
@@ -176,7 +176,7 @@ func TestInit(t *testing.T) { | |
"Fetching package template...", | ||
"Updating package manifest...", | ||
}, | ||
manifestIncludes: `authors = ["[email protected]"]`, | ||
manifestIncludes: []string{`authors = ["[email protected]"]`}, | ||
}, | ||
{ | ||
name: "with multiple authors", | ||
|
@@ -194,7 +194,7 @@ func TestInit(t *testing.T) { | |
"Fetching package template...", | ||
"Updating package manifest...", | ||
}, | ||
manifestIncludes: `authors = ["[email protected]", "[email protected]"]`, | ||
manifestIncludes: []string{`authors = ["[email protected]", "[email protected]"]`}, | ||
}, | ||
|
||
{ | ||
|
@@ -255,7 +255,10 @@ func TestInit(t *testing.T) { | |
CreateDomainFn: createDomainOK, | ||
CreateBackendFn: createBackendOK, | ||
}, | ||
manifestIncludes: `authors = ["[email protected]"]`, | ||
manifestIncludes: []string{ | ||
`authors = ["[email protected]"]`, | ||
`name = "fastly-build"`, | ||
}, | ||
wantFiles: []string{ | ||
"Cargo.toml", | ||
"fastly.toml", | ||
|
@@ -322,12 +325,12 @@ func TestInit(t *testing.T) { | |
for _, s := range testcase.wantOutput { | ||
testutil.AssertStringContains(t, buf.String(), s) | ||
} | ||
if testcase.manifestIncludes != "" { | ||
content, err := ioutil.ReadFile(filepath.Join(rootdir, compute.ManifestFilename)) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
testutil.AssertStringContains(t, string(content), testcase.manifestIncludes) | ||
content, err := ioutil.ReadFile(filepath.Join(rootdir, compute.ManifestFilename)) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
for _, s := range testcase.manifestIncludes { | ||
testutil.AssertStringContains(t, string(content), s) | ||
} | ||
}) | ||
} | ||
|