Skip to content

Commit 17d44d9

Browse files
Check for empty list
1 parent 0903bac commit 17d44d9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

pkg/onepassword/client/sdk/sdk_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ func TestSDK_GetItemsByTitle(t *testing.T) {
104104
clienttesting.CheckSDKItemOverviewMapping(t, sdkItem2, &items[1])
105105
},
106106
},
107+
"should return empty list": {
108+
mockItemAPI: func() *clientmock.ItemAPIMock {
109+
m := &clientmock.ItemAPIMock{}
110+
m.On("List", context.Background(), "vault-id", mock.Anything).Return([]sdk.ItemOverview{}, nil)
111+
return m
112+
},
113+
check: func(t *testing.T, items []model.Item, err error) {
114+
require.NoError(t, err)
115+
require.Len(t, items, 0)
116+
},
117+
},
107118
"should return an error": {
108119
mockItemAPI: func() *clientmock.ItemAPIMock {
109120
m := &clientmock.ItemAPIMock{}

0 commit comments

Comments
 (0)