diff options
author | 2023-08-21 16:25:23 -0700 | |
---|---|---|
committer | 2023-08-21 16:25:23 -0700 | |
commit | 752e59f23c78937558618f30c27abf3eafd8d5d5 (patch) | |
tree | fb3d5f8fc2eba8993b77859bac48c0897d5aaf94 /test/js | |
parent | def5a85d90e5102ab52e6960e8caab3c3f8ab3e8 (diff) | |
download | bun-752e59f23c78937558618f30c27abf3eafd8d5d5.tar.gz bun-752e59f23c78937558618f30c27abf3eafd8d5d5.tar.zst bun-752e59f23c78937558618f30c27abf3eafd8d5d5.zip |
Fixes #4089 (#4105)
* Fixes #4089
* Update bindings.cpp
* address PR feedback
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'test/js')
-rw-r--r-- | test/js/bun/test/expect.test.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/js/bun/test/expect.test.js b/test/js/bun/test/expect.test.js index 397afd0d9..804a5339f 100644 --- a/test/js/bun/test/expect.test.js +++ b/test/js/bun/test/expect.test.js @@ -955,6 +955,34 @@ describe("expect()", () => { }).toThrow(); }); + test("deepEquals URLs", () => { + const equals = [ + [ + [new URL("https://example.com"), new URL("https://example.com")], + [new URL("https://example.com"), new URL("https://example.com/")], + [Object.fromEntries(Object.entries(new URL("https://example.com"))), new URL("https://example.com/")], + ], + ]; + const not = [ + [new URL("https://example.com"), new URL("https://example.com/1")], + [new URL("https://example.com"), new URL("https://example.com/1")], + ]; + + for (let [first, second] of equals) { + expect(first).toEqual(second); + expect(second).toEqual(first); + } + + for (let [first, second] of not) { + expect(first).not.toEqual(second); + expect(second).not.toEqual(first); + } + + expect(Object.fromEntries(Object.entries(new URL("https://example.com")))).not.toStrictEqual( + new URL("https://example.com/"), + ); + }); + test("toEqual objects and arrays", () => { { let obj = { 0: 4, 1: 3, length: 2 }; |