Skip to content

Commit 3162c87

Browse files
committed
fix: integrate review findings
1 parent 7a85934 commit 3162c87

File tree

6 files changed

+43
-3
lines changed

6 files changed

+43
-3
lines changed

internal/cmd/rabbitmq/credentials/create/create_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,16 @@ func Test_outputResult(t *testing.T) {
222222
},
223223
wantErr: false,
224224
},
225+
{
226+
name: "nil response",
227+
args: args{
228+
model: inputModel{
229+
GlobalFlagModel: &globalflags.GlobalFlagModel{},
230+
},
231+
instanceLabel: "",
232+
},
233+
wantErr: true,
234+
},
225235
{
226236
name: "no flags",
227237
args: args{

internal/cmd/rabbitmq/credentials/describe/describe_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,13 @@ func Test_outputResult(t *testing.T) {
261261
},
262262
wantErr: false,
263263
},
264+
{
265+
name: "empty",
266+
args: args{
267+
outputFormat: "",
268+
},
269+
wantErr: true,
270+
},
264271
}
265272
p := print.NewPrinter()
266273
p.Cmd = NewCmd(p)

internal/cmd/rabbitmq/instance/create/create.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ func outputResult(p *print.Printer, model *inputModel, projectLabel, instanceId
263263
if model.GlobalFlagModel == nil {
264264
return fmt.Errorf("no globalflags passed")
265265
}
266+
if resp == nil {
267+
return fmt.Errorf("no response passed")
268+
}
269+
266270
switch model.OutputFormat {
267271
case print.JSONOutputFormat:
268272
details, err := json.MarshalIndent(resp, "", " ")

internal/cmd/rabbitmq/instance/create/create_test.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,24 @@ func Test_outputResult(t *testing.T) {
501501
wantErr bool
502502
}{
503503
{
504-
name: "empty",
505-
args: args{model: inputModel{GlobalFlagModel: &globalflags.GlobalFlagModel{}}},
504+
name: "empty",
505+
args: args{
506+
model: inputModel{
507+
GlobalFlagModel: &globalflags.GlobalFlagModel{},
508+
},
509+
resp: &rabbitmq.CreateInstanceResponse{},
510+
},
506511
wantErr: false,
507512
},
513+
{
514+
name: "empty",
515+
args: args{
516+
model: inputModel{
517+
GlobalFlagModel: &globalflags.GlobalFlagModel{},
518+
},
519+
},
520+
wantErr: true,
521+
},
508522
}
509523
p := print.NewPrinter()
510524
p.Cmd = NewCmd(p)

internal/cmd/rabbitmq/instance/describe/describe_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ func Test_outputResult(t *testing.T) {
231231
args: args{instance: &rabbitmq.Instance{}},
232232
wantErr: false,
233233
},
234+
{
235+
name: "nil instance",
236+
args: args{},
237+
wantErr: true,
238+
},
234239
{
235240
name: "empty parameters",
236241
args: args{

internal/cmd/rabbitmq/plans/plans.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ func outputResult(p *print.Printer, outputFormat string, plans []rabbitmq.Offeri
164164
utils.PtrString(plan.Description),
165165
)
166166
}
167+
table.AddSeparator()
167168
}
168-
table.AddSeparator()
169169
}
170170
table.EnableAutoMergeOnColumns(1, 2)
171171
err := table.Display(p)

0 commit comments

Comments
 (0)