nock
Advanced tools
Comparing version 13.0.2 to 13.0.3
@@ -551,4 +551,11 @@ 'use strict' | ||
*/ | ||
const dataEqual = (expected, actual) => | ||
deepEqual(expand(expected), expand(actual)) | ||
const dataEqual = (expected, actual) => { | ||
if (isPlainObject(expected)) { | ||
expected = expand(expected) | ||
} | ||
if (isPlainObject(actual)) { | ||
actual = expand(actual) | ||
} | ||
return deepEqual(expected, actual) | ||
} | ||
@@ -577,13 +584,16 @@ /** | ||
if (Array.isArray(expected) || isPlainObject(expected)) { | ||
if (actual === undefined) { | ||
if (Array.isArray(expected) && Array.isArray(actual)) { | ||
if (expected.length !== actual.length) { | ||
return false | ||
} | ||
const expKeys = Object.keys(expected) | ||
if (expKeys.length !== Object.keys(actual).length) { | ||
return false | ||
} | ||
return expected.every((expVal, idx) => deepEqual(expVal, actual[idx])) | ||
} | ||
return expKeys.every(key => deepEqual(expected[key], actual[key])) | ||
if (isPlainObject(expected) && isPlainObject(actual)) { | ||
const allKeys = Array.from( | ||
new Set(Object.keys(expected).concat(Object.keys(actual))) | ||
) | ||
return allKeys.every(key => deepEqual(expected[key], actual[key])) | ||
} | ||
@@ -590,0 +600,0 @@ |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "13.0.2", | ||
"version": "13.0.3", | ||
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>", | ||
@@ -13,0 +13,0 @@ "repository": { |
173320
3390