X Tutup
Skip to content

Commit 16739c3

Browse files
committed
Whoops, gist create stderr is not empty
1 parent b195075 commit 16739c3

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

pkg/cmd/gist/create/create_test.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ func Test_createRun(t *testing.T) {
146146
opts *CreateOptions
147147
stdin string
148148
wantOut string
149+
wantStderr string
149150
wantParams map[string]interface{}
150151
wantErr bool
151152
}{
@@ -155,8 +156,9 @@ func Test_createRun(t *testing.T) {
155156
Public: true,
156157
Filenames: []string{fixtureFile},
157158
},
158-
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
159-
wantErr: false,
159+
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
160+
wantStderr: "- Creating gist...\n✓ Created gist\n",
161+
wantErr: false,
160162
wantParams: map[string]interface{}{
161163
"public": true,
162164
"files": map[string]interface{}{
@@ -172,8 +174,9 @@ func Test_createRun(t *testing.T) {
172174
Description: "an incredibly interesting gist",
173175
Filenames: []string{fixtureFile},
174176
},
175-
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
176-
wantErr: false,
177+
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
178+
wantStderr: "- Creating gist...\n✓ Created gist\n",
179+
wantErr: false,
177180
wantParams: map[string]interface{}{
178181
"description": "an incredibly interesting gist",
179182
"files": map[string]interface{}{
@@ -188,9 +191,10 @@ func Test_createRun(t *testing.T) {
188191
opts: &CreateOptions{
189192
Filenames: []string{fixtureFile, "-"},
190193
},
191-
stdin: "cool stdin content",
192-
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
193-
wantErr: false,
194+
stdin: "cool stdin content",
195+
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
196+
wantStderr: "- Creating gist...\n✓ Created gist\n",
197+
wantErr: false,
194198
wantParams: map[string]interface{}{
195199
"files": map[string]interface{}{
196200
"gistCreate.json": map[string]interface{}{
@@ -207,9 +211,10 @@ func Test_createRun(t *testing.T) {
207211
opts: &CreateOptions{
208212
Filenames: []string{"-"},
209213
},
210-
stdin: "cool stdin content",
211-
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
212-
wantErr: false,
214+
stdin: "cool stdin content",
215+
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
216+
wantStderr: "- Creating gist...\n✓ Created gist\n",
217+
wantErr: false,
213218
wantParams: map[string]interface{}{
214219
"files": map[string]interface{}{
215220
"gistfile0.txt": map[string]interface{}{
@@ -247,7 +252,7 @@ func Test_createRun(t *testing.T) {
247252
t.Fatalf("error decoding JSON: %v", err)
248253
}
249254
assert.Equal(t, tt.wantOut, stdout.String())
250-
assert.Equal(t, "", stderr.String())
255+
assert.Equal(t, tt.wantStderr, stderr.String())
251256
assert.Equal(t, tt.wantParams, reqBody)
252257
reg.Verify(t)
253258
})

0 commit comments

Comments
 (0)
X Tutup