Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log_controller_test_case: Fix deepEqual returning true for primitive types #533

Merged
merged 1 commit into from Apr 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
}
}