@@ -4,13 +4,12 @@ import (
44 "context"
55 "testing"
66
7- "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
8- "github.com/stackitcloud/stackit-cli/internal/pkg/print"
9- "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
10-
117 "github.com/google/go-cmp/cmp"
128 "github.com/google/go-cmp/cmp/cmpopts"
139 "github.com/google/uuid"
10+ "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
11+ "github.com/stackitcloud/stackit-cli/internal/pkg/print"
12+ "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1413 "github.com/stackitcloud/stackit-sdk-go/services/iaas"
1514)
1615
@@ -284,3 +283,39 @@ func TestBuildRequest(t *testing.T) {
284283 })
285284 }
286285}
286+
287+ func TestOutputResult (t * testing.T ) {
288+ type args struct {
289+ model * inputModel
290+ projectLabel string
291+ volume * iaas.Volume
292+ }
293+ tests := []struct {
294+ name string
295+ args args
296+ wantErr bool
297+ }{
298+ {
299+ name : "empty" ,
300+ args : args {},
301+ wantErr : true ,
302+ },
303+ {
304+ name : "volume as argument" ,
305+ args : args {
306+ model : fixtureInputModel (),
307+ volume : & iaas.Volume {},
308+ },
309+ wantErr : false ,
310+ },
311+ }
312+ p := print .NewPrinter ()
313+ p .Cmd = NewCmd (p )
314+ for _ , tt := range tests {
315+ t .Run (tt .name , func (t * testing.T ) {
316+ if err := outputResult (p , tt .args .model , tt .args .projectLabel , tt .args .volume ); (err != nil ) != tt .wantErr {
317+ t .Errorf ("outputResult() error = %v, wantErr %v" , err , tt .wantErr )
318+ }
319+ })
320+ }
321+ }
0 commit comments