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 (
15
15
16
16
"github.com/raystack/frontier/core/resource"
17
17
"github.com/raystack/frontier/internal/api/v1beta1/mocks"
18
+ "github.com/raystack/frontier/pkg/metadata"
18
19
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
19
20
"github.com/stretchr/testify/assert"
20
21
"github.com/stretchr/testify/mock"
@@ -62,6 +63,21 @@ func TestHandler_ListResources(t *testing.T) {
62
63
want : nil ,
63
64
wantErr : connect .NewError (connect .CodeInternal , ErrInternalServerError ),
64
65
},
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
+ },
65
81
{
66
82
name : "should return resources if resource service return nil error" ,
67
83
setup : func (rs * mocks.ResourceService ) {
You can’t perform that action at this time.
0 commit comments