Skip to content

Commit

Permalink
chore(SPV-804): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pawellewandowski98 committed May 23, 2024
1 parent e3ec337 commit 943a776
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions admin_contacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ func TestAdminContactActions(t *testing.T) {
case r.URL.Path == "/v1/admin/contact/search" && r.Method == http.MethodPost:
c := fixtures.Contact
c.ID = "1"
contacts := []*models.Contact{c}
json.NewEncoder(w).Encode(contacts)
content := models.PagedResponse[*models.Contact]{
Content: []*models.Contact{c},
}
json.NewEncoder(w).Encode(content)
case r.URL.Path == "/v1/admin/contact/1" && r.Method == http.MethodPatch:
contact := fixtures.Contact
json.NewEncoder(w).Encode(contact)
Expand All @@ -46,7 +48,7 @@ func TestAdminContactActions(t *testing.T) {
t.Run("AdminGetContacts", func(t *testing.T) {
contacts, err := client.AdminGetContacts(context.Background(), nil, nil, nil)
require.NoError(t, err)
require.Equal(t, "1", contacts[0].ID)
require.Equal(t, "1", contacts.Content[0].ID)
})

t.Run("AdminUpdateContact", func(t *testing.T) {
Expand Down
5 changes: 4 additions & 1 deletion contacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ func TestContactActionsRouting(t *testing.T) {
}
case r.URL.Path == "/v1/contact/search":
if r.Method == http.MethodPost {
json.NewEncoder(w).Encode([]*models.Contact{fixtures.Contact})
content := models.PagedResponse[*models.Contact]{
Content: []*models.Contact{fixtures.Contact},
}
json.NewEncoder(w).Encode(content)
}
case strings.HasPrefix(r.URL.Path, "/v1/contact/"):
if r.Method == http.MethodPost || r.Method == http.MethodPut {
Expand Down

0 comments on commit 943a776

Please sign in to comment.