Skip to content

Commit c686c3c

Browse files
committed
Ensure submit prints on success
1 parent 8a9c2f3 commit c686c3c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

cmd/submit_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ func TestSubmitFiles(t *testing.T) {
145145
co := newCapturedOutput()
146146
co.override()
147147
defer co.reset()
148+
Err = &bytes.Buffer{}
148149

149150
// The fake endpoint will populate this when it receives the call from the command.
150151
submittedFiles := map[string]string{}
@@ -186,14 +187,16 @@ func TestSubmitFiles(t *testing.T) {
186187
files := []string{
187188
file1, file2, readme,
188189
}
189-
err = runSubmit(cfg, pflag.NewFlagSet("fake", pflag.PanicOnError), files)
190-
assert.NoError(t, err)
191190

192-
assert.Equal(t, 3, len(submittedFiles))
191+
err = runSubmit(cfg, pflag.NewFlagSet("fake", pflag.PanicOnError), files)
193192

194-
assert.Equal(t, "This is file 1.", submittedFiles["file-1.txt"])
195-
assert.Equal(t, "This is file 2.", submittedFiles["subdir/file-2.txt"])
196-
assert.Equal(t, "This is the readme.", submittedFiles["README.md"])
193+
if assert.NoError(t, err) {
194+
assert.Equal(t, 3, len(submittedFiles))
195+
assert.Equal(t, "This is file 1.", submittedFiles["file-1.txt"])
196+
assert.Equal(t, "This is file 2.", submittedFiles["subdir/file-2.txt"])
197+
assert.Equal(t, "This is the readme.", submittedFiles["README.md"])
198+
assert.Regexp(t, "submitted successfully", Err)
199+
}
197200
}
198201

199202
func TestLegacyMetadataMigration(t *testing.T) {

0 commit comments

Comments
 (0)