aboutsummaryrefslogtreecommitdiff
path: root/test/js
diff options
context:
space:
mode:
Diffstat (limited to 'test/js')
-rw-r--r--test/js/bun/test/expect.test.js28
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 };