File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
internal/api/v1beta1connect Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import (
1515
1616 "github.com/raystack/frontier/core/resource"
1717 "github.com/raystack/frontier/internal/api/v1beta1/mocks"
18+ "github.com/raystack/frontier/pkg/metadata"
1819 frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
1920 "github.com/stretchr/testify/assert"
2021 "github.com/stretchr/testify/mock"
@@ -62,6 +63,21 @@ func TestHandler_ListResources(t *testing.T) {
6263 want : nil ,
6364 wantErr : connect .NewError (connect .CodeInternal , ErrInternalServerError ),
6465 },
66+ {
67+ name : "should return internal error if transformation fails" ,
68+ setup : func (rs * mocks.ResourceService ) {
69+ rs .EXPECT ().List (mock .AnythingOfType ("context.backgroundCtx" ), resource.Filter {}).Return ([]resource.Resource {
70+ {
71+ Metadata : metadata.Metadata {
72+ "key" : map [int ]any {},
73+ },
74+ },
75+ }, nil )
76+ },
77+ request : connect .NewRequest (& frontierv1beta1.ListResourcesRequest {}),
78+ want : nil ,
79+ wantErr : connect .NewError (connect .CodeInternal , ErrInternalServerError ),
80+ },
6581 {
6682 name : "should return resources if resource service return nil error" ,
6783 setup : func (rs * mocks.ResourceService ) {
You can’t perform that action at this time.
0 commit comments