Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIRST-19] Test Case(s) for Invoices #5

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
mr improvements
  • Loading branch information
kmigielek committed Jan 24, 2024
commit f627e001f1bf88312bb2a00214451483b959cb59
8 changes: 7 additions & 1 deletion test/invoice_test.go
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import (
"testing"
"time"

"github.com/maxio-com/ab-golang-sdk/errors"
"github.com/maxio-com/ab-golang-sdk/models"
)

@@ -94,6 +95,7 @@ func (s *APISuite) TestInvoice() {

s.NoError(err)
s.Equal(http.StatusOK, events.Response.StatusCode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add one small assertion that the response list is not empty? Just to check sdk deserializes it

s.Greater(len(events.Data.Events), 0)
},
},
{
@@ -125,8 +127,12 @@ func (s *APISuite) TestInvoice() {
},
},
assert: func(t *testing.T, resp models.ApiResponse[models.InvoiceResponse], invoice models.CreateInvoice, err error) {
// s.Equal(err.Error(), errors.NewNestedErrorResponse(422, "Unprocessable Entity (WebDAV)").Error()) // not able to reat nested error messages here
s.Equal(err.Error(), errors.NewErrorArrayMapResponse(422, "Unprocessable Entity (WebDAV)").Error())
s.Equal(http.StatusUnprocessableEntity, resp.Response.StatusCode)

_, ok := err.(*errors.ErrorArrayMapResponse)
s.True(ok)
// cant check list of errors because map is nil
},
},
}