diff options
author | 2023-10-16 17:37:14 -0300 | |
---|---|---|
committer | 2023-10-16 15:14:15 -0700 | |
commit | 7becb5ec7457644e5229c03f17c3b99090e6b3c7 (patch) | |
tree | 70a67762d987bb0829d6b6bc02e7d9c68e8d6dda /src/bun.js/bindings | |
parent | c3f5baa091968e0807724e6fe1d836bbd8a3f115 (diff) | |
download | bun-7becb5ec7457644e5229c03f17c3b99090e6b3c7.tar.gz bun-7becb5ec7457644e5229c03f17c3b99090e6b3c7.tar.zst bun-7becb5ec7457644e5229c03f17c3b99090e6b3c7.zip |
fix(jest): fix toStrictEqual on same URLs (#6528)
Fixes #6492
Diffstat (limited to 'src/bun.js/bindings')
-rw-r--r-- | src/bun.js/bindings/bindings.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index 2efbde7b0..778ce4bce 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -669,6 +669,7 @@ bool Bun__deepEquals(JSC__JSGlobalObject* globalObject, JSValue v1, JSValue v2, case JSDOMWrapperType: { if (c2Type == JSDOMWrapperType) { // https://github.com/oven-sh/bun/issues/4089 + // https://github.com/oven-sh/bun/issues/6492 auto* url2 = jsDynamicCast<JSDOMURL*>(v2); auto* url1 = jsDynamicCast<JSDOMURL*>(v1); @@ -677,19 +678,15 @@ bool Bun__deepEquals(JSC__JSGlobalObject* globalObject, JSValue v1, JSValue v2, if ((url2 == nullptr) != (url1 == nullptr)) { return false; } - - if (url2 && url1) { - return url1->wrapped().href() != url2->wrapped().href(); - } - } else { - if (url2 && url1) { - // toEqual should return false when the URLs' href is not equal - // But you could have added additional properties onto the - // url object itself, so we must check those as well - // But it's definitely not equal if the href() is not the same - if (url1->wrapped().href() != url2->wrapped().href()) { - return false; - } + } + + if (url2 && url1) { + // toEqual or toStrictEqual should return false when the URLs' href is not equal + // But you could have added additional properties onto the + // url object itself, so we must check those as well + // But it's definitely not equal if the href() is not the same + if (url1->wrapped().href() != url2->wrapped().href()) { + return false; } } } |