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:
Kirill
2023-12-11 03:19:12 +03:00
committed by GitHub
parent 922e2de8b0
commit 1494ff5905
33 changed files with 744 additions and 123 deletions

View File

@@ -25,7 +25,7 @@ func TestCreateDeliveryPolygon(t *testing.T) {
Coordinates: "[[[30.149574279785153,59.86550435303646],[30.21205902099609,59.846884387977326],[30.255661010742184,59.86240174913176],[30.149574279785153,59.86550435303646]]]",
},
`{
"polygonId": "1323"
"polygon_id": 1323
}`,
},
// Test No Client-Id or Api-Key
@@ -47,8 +47,11 @@ func TestCreateDeliveryPolygon(t *testing.T) {
resp, err := c.Polygons().CreateDelivery(ctx, test.params)
if err != nil {
t.Error(err)
continue
}
compareJsonResponse(t, test.response, &CreateDeliveryPolygonResponse{})
if resp.StatusCode != test.statusCode {
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
}
@@ -102,8 +105,11 @@ func TestLinkDeliveryMethodToPolygon(t *testing.T) {
resp, err := c.Polygons().Link(ctx, test.params)
if err != nil {
t.Error(err)
continue
}
compareJsonResponse(t, test.response, &LinkDeliveryMethodToPolygonResponse{})
if resp.StatusCode != test.statusCode {
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
}