Better tests (check that response match the structure) (#52)
Trailing zeros were removed from time in responses because of json marshaling features
This commit is contained in:
@@ -53,8 +53,11 @@ func TestCreateUpdateProformaLink(t *testing.T) {
|
||||
resp, err := c.Invoices().CreateUpdate(ctx, test.params)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
continue
|
||||
}
|
||||
|
||||
compareJsonResponse(t, test.response, &CreateUpdateProformaLinkResponse{})
|
||||
|
||||
if resp.StatusCode != test.statusCode {
|
||||
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||
}
|
||||
@@ -102,8 +105,11 @@ func TestGetProformaLink(t *testing.T) {
|
||||
resp, err := c.Invoices().Get(ctx, test.params)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
continue
|
||||
}
|
||||
|
||||
compareJsonResponse(t, test.response, &GetProformaLinkResponse{})
|
||||
|
||||
if resp.StatusCode != test.statusCode {
|
||||
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||
}
|
||||
@@ -149,8 +155,11 @@ func TestDeleteProformaLink(t *testing.T) {
|
||||
resp, err := c.Invoices().Delete(ctx, test.params)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
continue
|
||||
}
|
||||
|
||||
compareJsonResponse(t, test.response, &DeleteProformaLinkResponse{})
|
||||
|
||||
if resp.StatusCode != test.statusCode {
|
||||
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user