Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCrawfis committed Sep 11, 2023
1 parent 20c9922 commit 47c16a4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/cli/cmd/group/list/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ import (
"github.com/radius-project/radius/pkg/cli/clients"
"github.com/radius-project/radius/pkg/cli/connections"
"github.com/radius-project/radius/pkg/cli/framework"
"github.com/radius-project/radius/pkg/cli/objectformats"
"github.com/radius-project/radius/pkg/cli/output"
"github.com/radius-project/radius/pkg/cli/workspaces"
"github.com/radius-project/radius/pkg/to"
"github.com/radius-project/radius/pkg/ucp/api/v20220901privatepreview"
"github.com/radius-project/radius/test/radcli"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -102,6 +104,18 @@ func Test_Run(t *testing.T) {

Name: "kind-kind",
}

groups := []v20220901privatepreview.ResourceGroupResource{
{
Name: to.Ptr("rg1"),
ID: to.Ptr("/planes/radius/local/resourcegroups/rg1"),
},
{
Name: to.Ptr("rg2"),
ID: to.Ptr("/planes/radius/local/resourcegroups/rg2"),
},
}

outputSink := &output.MockOutput{}
runner := &Runner{
ConnectionFactory: &connections.MockFactory{ApplicationsManagementClient: appManagementClient},
Expand All @@ -113,6 +127,15 @@ func Test_Run(t *testing.T) {
err := runner.Run(context.Background())
require.NoError(t, err)

expected := []any{
output.FormattedOutput{
Format: "table",
Obj: groups,
Options: objectformats.GetResourceGroupTableFormat(),
},
}

require.Equal(t, expected, outputSink.Writes)
})

}

0 comments on commit 47c16a4

Please sign in to comment.