Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- expectStatus = function(expected)
- {
- var match = responseCode.code === expected;
- tests[expected] = match;
- if (!match)
- {
- throw "status code match failed";
- }
- }
- compareJson = function(comparingWhat, actualJson, expectedJson)
- {
- var fields = Object.keys(expectedJson);
- for (var i = 0; i < fields.length; i++)
- {
- field = fields[i]
- tests[comparingWhat + " : " + field] = JSON.stringify(actualJson[field]) === JSON.stringify(expectedJson[field]);
- }
- }
- compareJsonArray = function(comparingWhat, actualJsonArray, expectedJsonArray)
- {
- for (var i = 0; i < expectedJsonArray.length; i++)
- {
- var found = false
- for (var j = 0; j < actualJsonArray.length; j++)
- {
- if (actualJsonArray[j]["id"] === expectedJsonArray[i]["id"])
- {
- console.log(actualJsonArray[j]["id"] + " --- " + expectedJsonArray[i]["id"])
- compareJson("deals " + actualJsonArray[j]["id"], actualJsonArray[j], expectedJsonArray[i]);
- found = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement