Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function observableMatcher(
actual: any,
expected: any,
assert: any,
assertDeepEqual: any,
frameworkMatcher: any
): any {
if (Array.isArray(actual) && Array.isArray(expected)) {
actual = actual.map(deleteErrorNotificationStack);
expected = expected.map(deleteErrorNotificationStack);
if (frameworkMatcher) {
assertDeepEqual(actual, expected);
} else {
const passed = circularDeepEqual(actual, expected);
if (passed) {
assert(true, "");
return;
}
let message = "\nExpected \n";
actual.forEach((x: any) => (message += `\t${stringify(x)}\n`));
message += "\t\nto deep equal \n";
expected.forEach((x: any) => (message += `\t${stringify(x)}\n`));
assert(passed, message);
}
} else {
assertDeepEqual(actual, expected);
}
function defaultAssertDeepEqual(a: any, b: any): void {
if (circularDeepEqual(a, b)) {
return;
}
throw new Error(`Expected ${toString(a)} to equal ${toString(b)}.`);
}