Skip to content

Commit

Permalink
log_controller_test_case: Fix deepEqual returning true for primitive …
Browse files Browse the repository at this point in the history
…types (#533)
  • Loading branch information
jcpascual committed Apr 9, 2022
1 parent 4b5c238 commit 9c0fd71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tests/cases/log_controller_test_case.ts
Expand Up @@ -37,13 +37,15 @@ function slice(object: any, keys: string[]): any {
function deepEqual(obj1: any, obj2: any): boolean {
if (obj1 === obj2) {
return true
} else {
} else if (typeof obj1 === "object" && typeof obj2 === "object") {
if (Object.keys(obj1).length !== Object.keys(obj2).length) { return false }
for (var prop in obj1) {
if (!deepEqual(obj1[prop], obj2[prop])) {
return false
}
}
return true
} else {
return false
}
}

0 comments on commit 9c0fd71

Please sign in to comment.