extend tests

This commit is contained in:
diPhantxm
2023-03-18 03:05:06 +03:00
parent f59174519f
commit 466cbc6379
9 changed files with 322 additions and 33 deletions

View File

@@ -64,6 +64,17 @@ func TestGetAvailablePromotions(t *testing.T) {
if resp.StatusCode != test.statusCode {
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
}
if resp.StatusCode == http.StatusOK {
if len(resp.Result) > 0 {
if resp.Result[0].Id == 0 {
t.Errorf("Id cannot be 0")
}
if resp.Result[0].ActionType == "" {
t.Errorf("Action type cannot be empty")
}
}
}
}
}
@@ -122,5 +133,11 @@ func TestAddToPromotion(t *testing.T) {
if resp.StatusCode != test.statusCode {
t.Errorf("got wrong status code: got: %d, expected: %d", resp.StatusCode, test.statusCode)
}
if resp.StatusCode == http.StatusOK {
if len(resp.Result.ProductIds) != len(test.params.Products) {
t.Errorf("Length of products in response and request must be equal")
}
}
}
}