@@ -6,13 +6,12 @@ import (
66 "strings"
77 "testing"
88
9- "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
10- "github.com/stackitcloud/stackit-cli/internal/pkg/print"
11- "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
12-
139 "github.com/google/go-cmp/cmp"
1410 "github.com/google/go-cmp/cmp/cmpopts"
1511 "github.com/google/uuid"
12+ "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
13+ "github.com/stackitcloud/stackit-cli/internal/pkg/print"
14+ "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1615 "github.com/stackitcloud/stackit-sdk-go/services/dns"
1716)
1817
@@ -369,3 +368,39 @@ func TestBuildRequest(t *testing.T) {
369368 })
370369 }
371370}
371+
372+ func TestOutputResult (t * testing.T ) {
373+ type args struct {
374+ model * inputModel
375+ zoneLabel string
376+ resp * dns.RecordSetResponse
377+ }
378+ tests := []struct {
379+ name string
380+ args args
381+ wantErr bool
382+ }{
383+ {
384+ name : "empty" ,
385+ args : args {},
386+ wantErr : true ,
387+ },
388+ {
389+ name : "only record set as argument" ,
390+ args : args {
391+ model : fixtureInputModel (),
392+ resp : & dns.RecordSetResponse {Rrset : & dns.RecordSet {}},
393+ },
394+ wantErr : false ,
395+ },
396+ }
397+ p := print .NewPrinter ()
398+ p .Cmd = NewCmd (p )
399+ for _ , tt := range tests {
400+ t .Run (tt .name , func (t * testing.T ) {
401+ if err := outputResult (p , tt .args .model , tt .args .zoneLabel , tt .args .resp ); (err != nil ) != tt .wantErr {
402+ t .Errorf ("outputResult() error = %v, wantErr %v" , err , tt .wantErr )
403+ }
404+ })
405+ }
406+ }
0 commit comments