diff --git a/.prettierrc b/.prettierrc index ea1532270e..dbca747b92 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,7 +3,7 @@ "bracketSpacing": true, "endOfLine": "lf", "insertPragma": false, - "printWidth": 100, + "printWidth": 120, "quoteProps": "as-needed", "semi": true, "singleQuote": false, diff --git a/Base/res/ladybird/about-pages/about.html b/Base/res/ladybird/about-pages/about.html index fc8ccada26..a55ca29414 100644 --- a/Base/res/ladybird/about-pages/about.html +++ b/Base/res/ladybird/about-pages/about.html @@ -1,18 +1,18 @@ - - - - About URLs - - -

List of About URLs

- - + + + + About URLs + + +

List of About URLs

+ + diff --git a/Base/res/ladybird/about-pages/newtab.html b/Base/res/ladybird/about-pages/newtab.html index 0471ae776c..07e0dc7f6d 100644 --- a/Base/res/ladybird/about-pages/newtab.html +++ b/Base/res/ladybird/about-pages/newtab.html @@ -1,12 +1,12 @@ - - - New Tab - - + + + New Tab + + diff --git a/Base/res/ladybird/about-pages/settings.html b/Base/res/ladybird/about-pages/settings.html index 318dabebd5..2af58ca48a 100644 --- a/Base/res/ladybird/about-pages/settings.html +++ b/Base/res/ladybird/about-pages/settings.html @@ -300,10 +300,7 @@
- +

Ladybird Settings

@@ -350,9 +347,7 @@
-

- Select the engine that will provide search suggestions. -

+

Select the engine that will provide search suggestions.

Tell websites not to sell or share your data.

@@ -471,11 +464,7 @@

Use %s as a placeholder for the search query

- +
@@ -502,9 +491,7 @@
diff --git a/Base/res/ladybird/about-pages/settings/default-zoom-level.js b/Base/res/ladybird/about-pages/settings/default-zoom-level.js index ea79d1bf62..d43c2f5c08 100644 --- a/Base/res/ladybird/about-pages/settings/default-zoom-level.js +++ b/Base/res/ladybird/about-pages/settings/default-zoom-level.js @@ -1,23 +1,6 @@ const defaultZoomLevelDropdown = document.querySelector("#default-zoom-level"); -const zoomLevelFactors = [ - 1 / 3.0, - 0.5, - 2 / 3.0, - 0.75, - 0.8, - 0.9, - 1.0, - 1.1, - 1.25, - 1.5, - 1.75, - 2.0, - 2.5, - 3.0, - 4.0, - 5.0, -]; +const zoomLevelFactors = [1 / 3.0, 0.5, 2 / 3.0, 0.75, 0.8, 0.9, 1.0, 1.1, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0, 5.0]; const zoomLevelFactorMap = zoomLevelFactors.map(factor => ({ factor, diff --git a/Base/res/ladybird/templates/directory.html b/Base/res/ladybird/templates/directory.html index ca98a74359..b3554534f2 100644 --- a/Base/res/ladybird/templates/directory.html +++ b/Base/res/ladybird/templates/directory.html @@ -1,65 +1,67 @@ - - - Index of %path% - - - -
- -

Index of %path%

-
-

Open Parent Directory

-
- %contents% -
- + .open-parent { + background-image: url("resource://icons/16x16/open-parent-directory.png"); + } + + + +
+ +

Index of %path%

+
+

+ Open Parent Directory +

+
+ %contents% +
+ diff --git a/Base/res/ladybird/templates/error.html b/Base/res/ladybird/templates/error.html index 86a5e41c35..c7cf9abe44 100644 --- a/Base/res/ladybird/templates/error.html +++ b/Base/res/ladybird/templates/error.html @@ -1,58 +1,58 @@ - - - Error! - - - -
- - - - -

Failed to load %failed_url%

-
-

%error_message%

- + + + Error! + + + +
+ + + + +

Failed to load %failed_url%

+
+

%error_message%

+ diff --git a/Base/res/ladybird/templates/version.html b/Base/res/ladybird/templates/version.html index 77b5d5aa5f..dead18f48f 100644 --- a/Base/res/ladybird/templates/version.html +++ b/Base/res/ladybird/templates/version.html @@ -1,58 +1,58 @@ - - - About %browser_name% - - - -
- - - - -

About %browser_name%

-
- - - - - - - - - - - - - - - - - - - - - - - - - -
Version:%browser_version%
Arch:%arch_name%
Operating System:%os_name%
User Agent:%user_agent%
Command Line:%command_line%
Executable Path:%executable_path%
- + + + About %browser_name% + + + +
+ + + + +

About %browser_name%

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Version:%browser_version%
Arch:%arch_name%
Operating System:%os_name%
User Agent:%user_agent%
Command Line:%command_line%
Executable Path:%executable_path%
+ diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype-generic-functions.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype-generic-functions.js index fd6d260e31..5038198b55 100644 --- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype-generic-functions.js +++ b/Libraries/LibJS/Tests/builtins/Array/Array.prototype-generic-functions.js @@ -53,21 +53,9 @@ describe("ability to work with generic non-array objects", () => { } { const o = { length: 5, 0: "foo", 1: "bar", 3: "baz" }; - expect(Array.prototype.slice.call(o)).toEqual([ - "foo", - "bar", - undefined, - "baz", - undefined, - ]); + expect(Array.prototype.slice.call(o)).toEqual(["foo", "bar", undefined, "baz", undefined]); expect(Array.prototype.slice.call(o, 0, 3)).toEqual(["foo", "bar", undefined]); - expect(Array.prototype.slice.call(o, 0, 15)).toEqual([ - "foo", - "bar", - undefined, - "baz", - undefined, - ]); + expect(Array.prototype.slice.call(o, 0, 15)).toEqual(["foo", "bar", undefined, "baz", undefined]); expect(Array.prototype.slice.call(o, 1)).toEqual(["bar", undefined, "baz", undefined]); expect(Array.prototype.slice.call(o, 15)).toEqual([]); @@ -89,13 +77,9 @@ describe("ability to work with generic non-array objects", () => { expect(Array.prototype.join.call({ length: "foo" })).toBe(""); expect(Array.prototype.join.call({ length: 3 })).toBe(",,"); expect(Array.prototype.join.call({ length: 2, 0: "foo", 1: "bar" })).toBe("foo,bar"); - expect(Array.prototype.join.call({ length: 2, 0: "foo", 1: "bar", 2: "baz" })).toBe( - "foo,bar" - ); + expect(Array.prototype.join.call({ length: 2, 0: "foo", 1: "bar", 2: "baz" })).toBe("foo,bar"); expect(Array.prototype.join.call({ length: 3, 1: "bar" }, "~")).toBe("~bar~"); - expect(Array.prototype.join.call({ length: 3, 0: "foo", 1: "bar", 2: "baz" }, "~")).toBe( - "foo~bar~baz" - ); + expect(Array.prototype.join.call({ length: 3, 0: "foo", 1: "bar", 2: "baz" }, "~")).toBe("foo~bar~baz"); }); test("toString", () => { @@ -120,9 +104,7 @@ describe("ability to work with generic non-array objects", () => { expect(Array.prototype.lastIndexOf.call({ length: 1, 2: "foo" }, "foo")).toBe(-1); expect(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo" }, "foo")).toBe(2); expect(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo")).toBe(4); - expect(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", -2)).toBe( - 2 - ); + expect(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", -2)).toBe(2); }); test("includes", () => { @@ -279,13 +261,7 @@ describe("ability to work with generic non-array objects", () => { 3: "baz", [Symbol.isConcatSpreadable]: true, }; - expect(Array.prototype.concat.call(spreadable)).toEqual([ - "foo", - "bar", - undefined, - "baz", - undefined, - ]); + expect(Array.prototype.concat.call(spreadable)).toEqual(["foo", "bar", undefined, "baz", undefined]); expect(Array.prototype.concat.call(spreadable, [1, 2])).toEqual([ "foo", "bar", diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js index 5703a7bb7c..8274b67d35 100644 --- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js +++ b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js @@ -51,12 +51,6 @@ describe("normal behavior", () => { return arr.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) !== -1); }; expect(filterItems(fruits, "Berry")).toEqual(["Blueberry", "Raspberry"]); - expect(filterItems(fruits, "P")).toEqual([ - "Apple", - "Grape", - "Peach", - "Pineapple", - "Raspberry", - ]); + expect(filterItems(fruits, "P")).toEqual(["Apple", "Grape", "Peach", "Pineapple", "Raspberry"]); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js index 4b15e61a5e..b8ccf6793f 100644 --- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js +++ b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js @@ -32,11 +32,7 @@ describe("normal behavior", () => { }); test("can map based on callback return value", () => { - expect( - [undefined, null, true, "foo", 42, {}].map( - (value, index) => "" + index + " -> " + value - ) - ).toEqual([ + expect([undefined, null, true, "foo", 42, {}].map((value, index) => "" + index + " -> " + value)).toEqual([ "0 -> undefined", "1 -> null", "2 -> true", diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.sort.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.sort.js index de30d981a4..db2f72a5f7 100644 --- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.sort.js +++ b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.sort.js @@ -20,38 +20,12 @@ describe("Array.prototype.sort", () => { // mix of data, including empty slots and undefined arr = ["2", Infinity, null, null, , undefined, 5, , undefined, null, 54, "5"]; - expect(arr.sort()).toEqual([ - "2", - 5, - "5", - 54, - Infinity, - null, - null, - null, - undefined, - undefined, - , - , - ]); + expect(arr.sort()).toEqual(["2", 5, "5", 54, Infinity, null, null, null, undefined, undefined, , ,]); expect(arr.length).toEqual(12); // undefined compare function arr = ["2", Infinity, null, null, , undefined, 5n, , undefined, null, 54, "5"]; - expect(arr.sort(undefined)).toEqual([ - "2", - 5n, - "5", - 54, - Infinity, - null, - null, - null, - undefined, - undefined, - , - , - ]); + expect(arr.sort(undefined)).toEqual(["2", 5n, "5", 54, Infinity, null, null, null, undefined, undefined, , ,]); expect(arr.length).toEqual(12); // numeric data with compare function to sort numerically @@ -123,10 +97,7 @@ describe("Array.prototype.sort", () => { expect([].sort(expectNoCallCompareFunction)).toEqual([]); expect([1].sort(expectNoCallCompareFunction)).toEqual([1]); expect([1, undefined].sort(expectNoCallCompareFunction)).toEqual([1, undefined]); - expect([undefined, undefined].sort(expectNoCallCompareFunction)).toEqual([ - undefined, - undefined, - ]); + expect([undefined, undefined].sort(expectNoCallCompareFunction)).toEqual([undefined, undefined]); expect([, , 1, ,].sort(expectNoCallCompareFunction)).toEqual([1, , , ,]); expect([undefined, , 1, , undefined, ,].sort(expectNoCallCompareFunction)).toEqual([ 1, diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toLocaleString.js b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toLocaleString.js index 7b0ebe8258..e7cd923d6c 100644 --- a/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toLocaleString.js +++ b/Libraries/LibJS/Tests/builtins/Array/Array.prototype.toLocaleString.js @@ -65,8 +65,6 @@ describe("normal behavior", () => { expect([12, 34].toLocaleString("ar-u-nu-arab")).toBe("\u0661\u0662,\u0663\u0664"); expect([0.234].toLocaleString("en", { style: "percent" })).toBe("23%"); - expect([0.234].toLocaleString("ar-u-nu-arab", { style: "percent" })).toBe( - "\u0662\u0663\u066a\u061c" - ); + expect([0.234].toLocaleString("ar-u-nu-arab", { style: "percent" })).toBe("\u0662\u0663\u066a\u061c"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.js b/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.js index 7befe5aa57..5f6e087596 100644 --- a/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.js +++ b/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.js @@ -27,8 +27,5 @@ test("invalid ArrayBuffer maximum size option", () => { test("ArrayBuffer size exceeds maximum size", () => { expect(() => { new ArrayBuffer(10, { maxByteLength: 5 }); - }).toThrowWithMessage( - RangeError, - "ArrayBuffer byte length of 10 exceeds the max byte length of 5" - ); + }).toThrowWithMessage(RangeError, "ArrayBuffer byte length of 10 exceeds the max byte length of 5"); }); diff --git a/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.prototype.resize.js b/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.prototype.resize.js index 1b0a682740..5611b2a13e 100644 --- a/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.prototype.resize.js +++ b/Libraries/LibJS/Tests/builtins/ArrayBuffer/ArrayBuffer.prototype.resize.js @@ -36,10 +36,7 @@ describe("errors", () => { expect(() => { buffer.resize(11); - }).toThrowWithMessage( - RangeError, - "ArrayBuffer byte length of 11 exceeds the max byte length of 10" - ); + }).toThrowWithMessage(RangeError, "ArrayBuffer byte length of 11 exceeds the max byte length of 10"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.js b/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.js index 17012cf2ac..025050a580 100644 --- a/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.js +++ b/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.js @@ -7,10 +7,7 @@ describe("errors", () => { test("called without new", () => { expect(() => { AsyncDisposableStack(); - }).toThrowWithMessage( - TypeError, - "AsyncDisposableStack constructor must be called with 'new'" - ); + }).toThrowWithMessage(TypeError, "AsyncDisposableStack constructor must be called with 'new'"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.@@asyncDispose.js b/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.@@asyncDispose.js index 91212c1c80..22b3164096 100644 --- a/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.@@asyncDispose.js +++ b/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.@@asyncDispose.js @@ -3,7 +3,5 @@ test("length is 0", () => { }); test("is the same as disposeAsync", () => { - expect(AsyncDisposableStack.prototype[Symbol.asyncDispose]).toBe( - AsyncDisposableStack.prototype.disposeAsync - ); + expect(AsyncDisposableStack.prototype[Symbol.asyncDispose]).toBe(AsyncDisposableStack.prototype.disposeAsync); }); diff --git a/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.disposeAsync.js b/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.disposeAsync.js index e1ebee619a..f92eb509d2 100644 --- a/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.disposeAsync.js +++ b/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.disposeAsync.js @@ -80,9 +80,6 @@ describe("basic functionality", () => { }, }); - expect(async () => await stack.disposeAsync()).toThrowWithMessage( - ExpectationError, - "fail in dispose" - ); + expect(async () => await stack.disposeAsync()).toThrowWithMessage(ExpectationError, "fail in dispose"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.move.js b/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.move.js index 6ef47f91f9..af19334814 100644 --- a/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.move.js +++ b/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.move.js @@ -54,9 +54,6 @@ describe("throws errors", () => { await stack.disposeAsync(); expect(stack.disposed).toBeTrue(); - expect(() => stack.move()).toThrowWithMessage( - ReferenceError, - "AsyncDisposableStack already disposed values" - ); + expect(() => stack.move()).toThrowWithMessage(ReferenceError, "AsyncDisposableStack already disposed values"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.use.js b/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.use.js index d800b63165..b34c68c370 100644 --- a/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.use.js +++ b/Libraries/LibJS/Tests/builtins/AsyncDisposableStack/AsyncDisposableStack.prototype.use.js @@ -53,10 +53,7 @@ describe("throws errors", () => { test("if added object does not have a dispose method throws type error", () => { const stack = new AsyncDisposableStack(); [{}, [], { f() {} }].forEach(value => { - expect(() => stack.use(value)).toThrowWithMessage( - TypeError, - "does not have dispose method" - ); + expect(() => stack.use(value)).toThrowWithMessage(TypeError, "does not have dispose method"); }); expect(stack.disposed).toBeFalse(); diff --git a/Libraries/LibJS/Tests/builtins/AsyncGenerator/AsyncGenerator.prototype.next.js b/Libraries/LibJS/Tests/builtins/AsyncGenerator/AsyncGenerator.prototype.next.js index 9b4eaa31ff..9980adda81 100644 --- a/Libraries/LibJS/Tests/builtins/AsyncGenerator/AsyncGenerator.prototype.next.js +++ b/Libraries/LibJS/Tests/builtins/AsyncGenerator/AsyncGenerator.prototype.next.js @@ -105,9 +105,7 @@ describe("correct behaviour", () => { unhandledExceptionGenerator .next("bad10") .then(() => { - expect().fail( - "Unhandled exception generator did NOT throw an unhandled exception." - ); + expect().fail("Unhandled exception generator did NOT throw an unhandled exception."); }) .catch(e => { expect(e).toBe(1337); @@ -123,9 +121,7 @@ describe("correct behaviour", () => { expect(iteratorResult.done).toBeTrue(); }) .catch(e => { - expect().fail( - "Unhandled exception generator threw an unhandled exception in Completed state." - ); + expect().fail("Unhandled exception generator threw an unhandled exception in Completed state."); }); runQueuedPromiseJobs(); }); diff --git a/Libraries/LibJS/Tests/builtins/Atomics/Atomics.notify.js b/Libraries/LibJS/Tests/builtins/Atomics/Atomics.notify.js index 4a2584e040..9178187d1e 100644 --- a/Libraries/LibJS/Tests/builtins/Atomics/Atomics.notify.js +++ b/Libraries/LibJS/Tests/builtins/Atomics/Atomics.notify.js @@ -21,10 +21,7 @@ describe("errors", () => { expect(() => { const typedArray = new Float32Array(4); Atomics.notify(typedArray, 0, 0); - }).toThrowWithMessage( - TypeError, - "Typed array Float32Array element type is not Int32 or BigInt64" - ); + }).toThrowWithMessage(TypeError, "Typed array Float32Array element type is not Int32 or BigInt64"); }); test("invalid index", () => { diff --git a/Libraries/LibJS/Tests/builtins/Atomics/Atomics.wait.js b/Libraries/LibJS/Tests/builtins/Atomics/Atomics.wait.js index 6ada81671a..414cc6e293 100644 --- a/Libraries/LibJS/Tests/builtins/Atomics/Atomics.wait.js +++ b/Libraries/LibJS/Tests/builtins/Atomics/Atomics.wait.js @@ -21,10 +21,7 @@ describe("errors", () => { expect(() => { const typedArray = new Float32Array(4); Atomics.wait(typedArray, 0, 0, 0); - }).toThrowWithMessage( - TypeError, - "Typed array Float32Array element type is not Int32 or BigInt64" - ); + }).toThrowWithMessage(TypeError, "Typed array Float32Array element type is not Int32 or BigInt64"); }); test("non-shared ArrayBuffer", () => { diff --git a/Libraries/LibJS/Tests/builtins/Atomics/Atomics.waitAsync.js b/Libraries/LibJS/Tests/builtins/Atomics/Atomics.waitAsync.js index 7704edac5a..b2aaad8b06 100644 --- a/Libraries/LibJS/Tests/builtins/Atomics/Atomics.waitAsync.js +++ b/Libraries/LibJS/Tests/builtins/Atomics/Atomics.waitAsync.js @@ -21,10 +21,7 @@ describe("errors", () => { expect(() => { const typedArray = new Float32Array(4); Atomics.waitAsync(typedArray, 0, 0, 0); - }).toThrowWithMessage( - TypeError, - "Typed array Float32Array element type is not Int32 or BigInt64" - ); + }).toThrowWithMessage(TypeError, "Typed array Float32Array element type is not Int32 or BigInt64"); }); test("non-shared ArrayBuffer", () => { diff --git a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toLocaleString.js b/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toLocaleString.js index d33b7ba5e3..6954849291 100644 --- a/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toLocaleString.js +++ b/Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toLocaleString.js @@ -33,36 +33,22 @@ test("integer digits", () => { expect(1n.toLocaleString("ar-u-nu-arab", { minimumIntegerDigits: 2 })).toBe("\u0660\u0661"); expect(12n.toLocaleString("ar-u-nu-arab", { minimumIntegerDigits: 2 })).toBe("\u0661\u0662"); - expect(123n.toLocaleString("ar-u-nu-arab", { minimumIntegerDigits: 2 })).toBe( - "\u0661\u0662\u0663" - ); + expect(123n.toLocaleString("ar-u-nu-arab", { minimumIntegerDigits: 2 })).toBe("\u0661\u0662\u0663"); }); test("significant digits", () => { - expect( - 1n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 }) - ).toBe("1.000"); - expect( - 12n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 }) - ).toBe("12.00"); - expect( - 123n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 }) - ).toBe("123.0"); - expect( - 1234n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 }) - ).toBe("1,234"); - expect( - 12345n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 }) - ).toBe("12,345"); - expect( - 123456n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 }) - ).toBe("123,456"); - expect( - 1234567n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 }) - ).toBe("1,234,570"); - expect( - 1234561n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 }) - ).toBe("1,234,560"); + expect(1n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 })).toBe("1.000"); + expect(12n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 })).toBe("12.00"); + expect(123n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 })).toBe("123.0"); + expect(1234n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 })).toBe("1,234"); + expect(12345n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 })).toBe("12,345"); + expect(123456n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 })).toBe("123,456"); + expect(1234567n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 })).toBe( + "1,234,570" + ); + expect(1234561n.toLocaleString("en", { minimumSignificantDigits: 4, maximumSignificantDigits: 6 })).toBe( + "1,234,560" + ); expect( 1n.toLocaleString("ar-u-nu-arab", { diff --git a/Libraries/LibJS/Tests/builtins/BigInt/bigint-basic.js b/Libraries/LibJS/Tests/builtins/BigInt/bigint-basic.js index 090f89dde5..34c95c32a3 100644 --- a/Libraries/LibJS/Tests/builtins/BigInt/bigint-basic.js +++ b/Libraries/LibJS/Tests/builtins/BigInt/bigint-basic.js @@ -30,8 +30,7 @@ describe("correct behavior", () => { expect(2n ** 3n).toBe(8n); expect(5n % 3n).toBe(2n); expect( - 45977665298704210987n + - (714320987142450987412098743217984576n / 4598741987421098765327980n) * 987498743n + 45977665298704210987n + (714320987142450987412098743217984576n / 4598741987421098765327980n) * 987498743n ).toBe(199365500239020623962n); }); diff --git a/Libraries/LibJS/Tests/builtins/BigInt/bigint-number-mix-errors.js b/Libraries/LibJS/Tests/builtins/BigInt/bigint-number-mix-errors.js index de80b92b3a..cd91427d5a 100644 --- a/Libraries/LibJS/Tests/builtins/BigInt/bigint-number-mix-errors.js +++ b/Libraries/LibJS/Tests/builtins/BigInt/bigint-number-mix-errors.js @@ -4,10 +4,7 @@ const doTest = (operatorName, executeOperation) => { expect(() => { executeOperation(1n, value); - }).toThrowWithMessage( - TypeError, - `Cannot use ${operatorName} operator with BigInt${messageSuffix}` - ); + }).toThrowWithMessage(TypeError, `Cannot use ${operatorName} operator with BigInt${messageSuffix}`); }); }; diff --git a/Libraries/LibJS/Tests/builtins/DataView/DataView-invalid-read-and-write.js b/Libraries/LibJS/Tests/builtins/DataView/DataView-invalid-read-and-write.js index 1ab5244e57..1eeaf821e8 100644 --- a/Libraries/LibJS/Tests/builtins/DataView/DataView-invalid-read-and-write.js +++ b/Libraries/LibJS/Tests/builtins/DataView/DataView-invalid-read-and-write.js @@ -2,28 +2,19 @@ test("Issue #9336, integer overflow in get_view_value", () => { const dataView = new DataView(new ArrayBuffer(16)); expect(() => { dataView.getUint32(0xfffffffc); - }).toThrowWithMessage( - RangeError, - "Data view byte offset 4294967292 is out of range for buffer with length 16" - ); + }).toThrowWithMessage(RangeError, "Data view byte offset 4294967292 is out of range for buffer with length 16"); }); test("Issue #9338, integer overflow in set_view_value", () => { const dataView = new DataView(new ArrayBuffer(16)); expect(() => { dataView.setUint32(0xfffffffc, 0); - }).toThrowWithMessage( - RangeError, - "Data view byte offset 4294967292 is out of range for buffer with length 16" - ); + }).toThrowWithMessage(RangeError, "Data view byte offset 4294967292 is out of range for buffer with length 16"); }); test("Issue #9338, integer overflow in set_view_value - zero-length DataView", () => { const dataView = new DataView(new ArrayBuffer(4), 4); expect(() => { dataView.setUint32(0xfffffffc, 0); - }).toThrowWithMessage( - RangeError, - "Data view byte offset 4294967292 is out of range for buffer with length 0" - ); + }).toThrowWithMessage(RangeError, "Data view byte offset 4294967292 is out of range for buffer with length 0"); }); diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.parse.js b/Libraries/LibJS/Tests/builtins/Date/Date.parse.js index 08b5cc4503..17cd6b9b62 100644 --- a/Libraries/LibJS/Tests/builtins/Date/Date.parse.js +++ b/Libraries/LibJS/Tests/builtins/Date/Date.parse.js @@ -25,9 +25,7 @@ test("basic functionality", () => { expect(Date.parse("2024-01-08 9:00Z")).toBe(1704704400000); expect(Date.parse("Wed, 17 Jan 2024 11:36:34 +0000")).toBe(1705491394000); expect(Date.parse("Thu, 09 Jan 2025 23:00:00")).toBe(1736485200000); - expect(Date.parse("Sun Jan 21 2024 21:11:31 GMT +0100 (Central European Standard Time)")).toBe( - 1705867891000 - ); + expect(Date.parse("Sun Jan 21 2024 21:11:31 GMT +0100 (Central European Standard Time)")).toBe(1705867891000); expect(Date.parse("05 Jul 2024 00:00")).toBe(1720155600000); expect(Date.parse("05 Jul 2024")).toBe(1720155600000); expect(Date.parse("05 July 2024")).toBe(1720155600000); diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.parse.nonStandard.js b/Libraries/LibJS/Tests/builtins/Date/Date.parse.nonStandard.js index 31b846e3a4..c12a381431 100644 --- a/Libraries/LibJS/Tests/builtins/Date/Date.parse.nonStandard.js +++ b/Libraries/LibJS/Tests/builtins/Date/Date.parse.nonStandard.js @@ -73,9 +73,7 @@ test("canonical format: ECMA date time string format", () => { expect("1980-10-01T10:34:56.789Z").toBe(new Date("1980-10T12:34:56.789+0200").toISOString()); expect("1980-10-11T10:34:56.789Z").toBe(new Date("1980-10-11T12:34:56.789+0200").toISOString()); - expect("1980-10-11T10:34:54.789Z").toBe( - new Date("1980-10-11T12:34:56.789+020002").toISOString() - ); + expect("1980-10-11T10:34:54.789Z").toBe(new Date("1980-10-11T12:34:56.789+020002").toISOString()); // Timezone offset HH:MM expect("1980-01-01T10:34:00.000Z").toBe(new Date("1980T12:34+02:00").toISOString()); @@ -88,9 +86,7 @@ test("canonical format: ECMA date time string format", () => { expect("1980-01-01T10:34:56.789Z").toBe(new Date("1980T12:34:56.789+02:00").toISOString()); expect("1980-10-01T10:34:56.789Z").toBe(new Date("1980-10T12:34:56.789+02:00").toISOString()); - expect("1980-10-11T10:34:56.789Z").toBe( - new Date("1980-10-11T12:34:56.789+02:00").toISOString() - ); + expect("1980-10-11T10:34:56.789Z").toBe(new Date("1980-10-11T12:34:56.789+02:00").toISOString()); setTimeZone(originalTimeZone); }); @@ -109,12 +105,8 @@ test('canonical format: ECMA + ISO8601 extensions ("simplified" ISO8601)', () => expect("1980-10-11T10:34:11.000Z").toBe(new Date("1980-10-11T12:34:56+02:00:45").toISOString()); expect("1980-01-01T10:34:11.789Z").toBe(new Date("1980T12:34:56.789+02:00:45").toISOString()); - expect("1980-10-01T10:34:11.789Z").toBe( - new Date("1980-10T12:34:56.789+02:00:45").toISOString() - ); - expect("1980-10-11T10:34:11.789Z").toBe( - new Date("1980-10-11T12:34:56.789+02:00:45").toISOString() - ); + expect("1980-10-01T10:34:11.789Z").toBe(new Date("1980-10T12:34:56.789+02:00:45").toISOString()); + expect("1980-10-11T10:34:11.789Z").toBe(new Date("1980-10-11T12:34:56.789+02:00:45").toISOString()); // The ECMA date-time string format requires literal uppercase 'T' and 'Z'. // Chrome also accepts lowercase. @@ -126,37 +118,19 @@ test('canonical format: ECMA + ISO8601 extensions ("simplified" ISO8601)', () => // Timezone offset HH:MM:SS.Ns expect("1980-01-01T10:33:14.322Z").toBe(new Date("1980T12:34+02:00:45.678").toISOString()); expect("1980-10-01T10:33:14.322Z").toBe(new Date("1980-10T12:34+02:00:45.678").toISOString()); - expect("1980-10-11T10:33:14.322Z").toBe( - new Date("1980-10-11T12:34+02:00:45.678").toISOString() - ); + expect("1980-10-11T10:33:14.322Z").toBe(new Date("1980-10-11T12:34+02:00:45.678").toISOString()); expect("1980-01-01T10:34:10.322Z").toBe(new Date("1980T12:34:56+02:00:45.678").toISOString()); - expect("1980-10-01T10:34:10.322Z").toBe( - new Date("1980-10T12:34:56+02:00:45.678").toISOString() - ); - expect("1980-10-11T10:34:10.322Z").toBe( - new Date("1980-10-11T12:34:56+02:00:45.678").toISOString() - ); + expect("1980-10-01T10:34:10.322Z").toBe(new Date("1980-10T12:34:56+02:00:45.678").toISOString()); + expect("1980-10-11T10:34:10.322Z").toBe(new Date("1980-10-11T12:34:56+02:00:45.678").toISOString()); - expect("1980-01-01T10:34:11.111Z").toBe( - new Date("1980T12:34:56.789+02:00:45.678").toISOString() - ); - expect("1980-10-01T10:34:11.111Z").toBe( - new Date("1980-10T12:34:56.789+02:00:45.678").toISOString() - ); - expect("1980-10-11T10:34:11.111Z").toBe( - new Date("1980-10-11T12:34:56.789+02:00:45.678").toISOString() - ); + expect("1980-01-01T10:34:11.111Z").toBe(new Date("1980T12:34:56.789+02:00:45.678").toISOString()); + expect("1980-10-01T10:34:11.111Z").toBe(new Date("1980-10T12:34:56.789+02:00:45.678").toISOString()); + expect("1980-10-11T10:34:11.111Z").toBe(new Date("1980-10-11T12:34:56.789+02:00:45.678").toISOString()); - expect("1980-01-01T10:34:11.666Z").toBe( - new Date("1980T12:34:56.789+02:00:45.123456879").toISOString() - ); - expect("1980-10-01T10:34:11.666Z").toBe( - new Date("1980-10T12:34:56.789+02:00:45.123456879").toISOString() - ); - expect("1980-10-11T10:34:11.666Z").toBe( - new Date("1980-10-11T12:34:56.789+02:00:45.123456879").toISOString() - ); + expect("1980-01-01T10:34:11.666Z").toBe(new Date("1980T12:34:56.789+02:00:45.123456879").toISOString()); + expect("1980-10-01T10:34:11.666Z").toBe(new Date("1980-10T12:34:56.789+02:00:45.123456879").toISOString()); + expect("1980-10-11T10:34:11.666Z").toBe(new Date("1980-10-11T12:34:56.789+02:00:45.123456879").toISOString()); // Expanded years https://tc39.es/ecma262/#sec-expanded-years expect("2023-01-01T00:00:00.000Z").toBe(new Date("+002023").toISOString()); @@ -168,40 +142,20 @@ test('canonical format: ECMA + ISO8601 extensions ("simplified" ISO8601)', () => expect("2023-10-11T19:34:56.789Z").toBe(new Date("+002023-10-11T12:34:56.789").toISOString()); expect("2023-10-11T12:34:56.000Z").toBe(new Date("+002023-10-11T12:34:56Z").toISOString()); expect("2023-10-11T12:34:56.789Z").toBe(new Date("+002023-10-11T12:34:56.789Z").toISOString()); - expect("2023-10-11T10:34:56.789Z").toBe( - new Date("+002023-10-11T12:34:56.789+0200").toISOString() - ); - expect("2023-10-11T10:34:56.789Z").toBe( - new Date("+002023-10-11T12:34:56.789+02:00").toISOString() - ); - expect("2023-10-11T10:34:11.666Z").toBe( - new Date("+002023-10-11T12:34:56.789+02:00:45.123").toISOString() - ); - expect("2023-10-11T10:34:11.666Z").toBe( - new Date("+002023-10-11T12:34:56.789+02:00:45.123456789").toISOString() - ); + expect("2023-10-11T10:34:56.789Z").toBe(new Date("+002023-10-11T12:34:56.789+0200").toISOString()); + expect("2023-10-11T10:34:56.789Z").toBe(new Date("+002023-10-11T12:34:56.789+02:00").toISOString()); + expect("2023-10-11T10:34:11.666Z").toBe(new Date("+002023-10-11T12:34:56.789+02:00:45.123").toISOString()); + expect("2023-10-11T10:34:11.666Z").toBe(new Date("+002023-10-11T12:34:56.789+02:00:45.123456789").toISOString()); expect("-002023-10-11T00:00:00.000Z").toBe(new Date("-002023-10-11").toISOString()); expect("-002023-10-11T20:46:28.000Z").toBe(new Date("-002023-10-11T12:34").toISOString()); expect("-002023-10-11T20:47:24.000Z").toBe(new Date("-002023-10-11T12:34:56").toISOString()); - expect("-002023-10-11T20:47:24.789Z").toBe( - new Date("-002023-10-11T12:34:56.789").toISOString() - ); - expect("-002023-10-11T10:34:56.789Z").toBe( - new Date("-002023-10-11T12:34:56.789+0200").toISOString() - ); - expect("-002023-10-11T10:34:56.789Z").toBe( - new Date("-002023-10-11T12:34:56.789+02:00").toISOString() - ); - expect("-002023-10-11T10:34:11.789Z").toBe( - new Date("-002023-10-11T12:34:56.789+02:00:45").toISOString() - ); - expect("-002023-10-11T10:34:11.666Z").toBe( - new Date("-002023-10-11T12:34:56.789+02:00:45.123").toISOString() - ); - expect("-002023-10-11T10:34:11.666Z").toBe( - new Date("-002023-10-11T12:34:56.789+02:00:45.123456789").toISOString() - ); + expect("-002023-10-11T20:47:24.789Z").toBe(new Date("-002023-10-11T12:34:56.789").toISOString()); + expect("-002023-10-11T10:34:56.789Z").toBe(new Date("-002023-10-11T12:34:56.789+0200").toISOString()); + expect("-002023-10-11T10:34:56.789Z").toBe(new Date("-002023-10-11T12:34:56.789+02:00").toISOString()); + expect("-002023-10-11T10:34:11.789Z").toBe(new Date("-002023-10-11T12:34:56.789+02:00:45").toISOString()); + expect("-002023-10-11T10:34:11.666Z").toBe(new Date("-002023-10-11T12:34:56.789+02:00:45.123").toISOString()); + expect("-002023-10-11T10:34:11.666Z").toBe(new Date("-002023-10-11T12:34:56.789+02:00:45.123456789").toISOString()); expect("0000-02-03T12:34:56.789Z").toBe(new Date("+000000-02-03T12:34:56.789Z").toISOString()); @@ -219,9 +173,7 @@ test("canonical format: Date.toString", () => { const originalTimeZone = setTimeZone("America/Vancouver"); expect("1999-12-08T12:34:56.000Z").toBe(new Date("Wed Dec 08 1999 12:34:56 GMT").toISOString()); // Clint Eastwood elected mayor of Carmel - expect("1999-12-08T20:34:56.000Z").toBe( - new Date("Wed Dec 08 1999 12:34:56 GMT-0800").toISOString() - ); + expect("1999-12-08T20:34:56.000Z").toBe(new Date("Wed Dec 08 1999 12:34:56 GMT-0800").toISOString()); expect("1999-12-08T20:34:56.000Z").toBe( new Date("Wed Dec 08 1999 12:34:56 GMT-0800 (Pacific Standard Time)").toISOString() ); @@ -234,12 +186,8 @@ test("canonical format: Date.toString", () => { }); test("canonical format: Date.toUTCString", () => { - expect("1999-12-08T08:00:00.000Z").toBe( - new Date("Wed, 08 Dec 1999 08:00:00 GMT").toISOString() - ); - expect("1999-12-08T08:00:00.000Z").toBe( - new Date("Thu, 08 Dec 1999 08:00:00 GMT").toISOString() - ); // Wrong weekday is ignored + expect("1999-12-08T08:00:00.000Z").toBe(new Date("Wed, 08 Dec 1999 08:00:00 GMT").toISOString()); + expect("1999-12-08T08:00:00.000Z").toBe(new Date("Thu, 08 Dec 1999 08:00:00 GMT").toISOString()); // Wrong weekday is ignored }); test("ambiguous date: 1 number", () => { @@ -573,12 +521,8 @@ test("timezone offset", () => { expect("2019-07-18T08:01:00.000Z").toBe(new Date("07/18/2019 11:22 +3:21").toISOString()); expect("2019-07-18T08:00:51.000Z").toBe(new Date("07/18/2019 11:22 +03:21:09").toISOString()); // Chrome and Firefox do not support seconds in timezone offset - expect("2019-07-18T08:00:50.877Z").toBe( - new Date("07/18/2019 11:22 +03:21:09.123").toISOString() - ); - expect("2019-07-18T08:00:50.877Z").toBe( - new Date("07/18/2019 11:22 +03:21:09.12345678").toISOString() - ); // Truncate to milliseconds + expect("2019-07-18T08:00:50.877Z").toBe(new Date("07/18/2019 11:22 +03:21:09.123").toISOString()); + expect("2019-07-18T08:00:50.877Z").toBe(new Date("07/18/2019 11:22 +03:21:09.12345678").toISOString()); // Truncate to milliseconds expect("2019-07-18T08:22:00.000Z").toBe(new Date("07/18/2019 11:22 GMT+03").toISOString()); expect("2019-07-18T08:22:00.000Z").toBe(new Date("07/18/2019 11:22 UTC+03").toISOString()); @@ -654,9 +598,7 @@ test("us timezones", () => { expect("2025-02-23T12:34:00.000Z").toBe(new Date("23 feb 2025 12:34 UTC").toISOString()); expect("2025-02-23T12:34:00.000Z").toBe(new Date("23 feb 2025 12:34 Z").toISOString()); - expect("2025-02-23T18:34:00.000Z").toBe( - new Date("23 EST feb PDT 2025 CST 12:34").toISOString() - ); // For multiple occurrences, the last one wins + expect("2025-02-23T18:34:00.000Z").toBe(new Date("23 EST feb PDT 2025 CST 12:34").toISOString()); // For multiple occurrences, the last one wins expect("2022-02-12T20:34:00.000Z").toBe(new Date("2/12/22 12:34 +0100 PST").toISOString()); // Timezone name wins after timezone offset. expect(Date.parse("12-Dec-2024 15:30:00 PT")).toBeNaN(); // Non-qualified timezone names ("PT"="Pacific Time"; no S/D) are not recognized @@ -682,9 +624,7 @@ test("weekdays", () => { expect("2024-12-05T08:00:00.000Z").toBe(new Date("Thurnip Dec 5 2024").toISOString()); expect("2024-12-05T08:00:00.000Z").toBe(new Date("Mon Dec 5 2024").toISOString()); // Incorrect weekday is ignored. expect("2024-12-05T08:00:00.000Z").toBe(new Date("Theater Dec 5 2024").toISOString()); // Anything before the first number is ignored. - expect("2024-12-05T08:00:00.000Z").toBe( - new Date("Mon Tue Wed Dec Thu YMCA 5 2024").toISOString() - ); + expect("2024-12-05T08:00:00.000Z").toBe(new Date("Mon Tue Wed Dec Thu YMCA 5 2024").toISOString()); expect(Date.parse("Mon Dec Tue 5 Wed 2024")).toBeNaN(); // Weekday names (or any other word) fail after the first number expect(Date.parse("Mon Dec Tue 5 Wed 2024 Thu")).toBeNaN(); @@ -696,15 +636,9 @@ test("timezone name", () => { // Compatible with Chrome and Firefox. Anything that is not a closing bracket following an open bracket is ignored. const originalTimeZone = setTimeZone("America/Vancouver"); - expect("2020-12-05T20:23:00.000Z").toBe( - new Date("Thu Dec 5 2020 12:23 -0800 (America/Vancouver)").toISOString() - ); - expect("2020-12-05T20:23:00.000Z").toBe( - new Date("Thu Dec 5 2020 12:23 -0800 (America/Chicago)").toISOString() - ); // Incorrect time zone name. - expect("2020-12-05T20:23:00.000Z").toBe( - new Date("Thu Dec 5 2020 12:23 (America/Chicago)").toISOString() - ); // Missing timezone offset makes it local time. Timezone name is ignored. + expect("2020-12-05T20:23:00.000Z").toBe(new Date("Thu Dec 5 2020 12:23 -0800 (America/Vancouver)").toISOString()); + expect("2020-12-05T20:23:00.000Z").toBe(new Date("Thu Dec 5 2020 12:23 -0800 (America/Chicago)").toISOString()); // Incorrect time zone name. + expect("2020-12-05T20:23:00.000Z").toBe(new Date("Thu Dec 5 2020 12:23 (America/Chicago)").toISOString()); // Missing timezone offset makes it local time. Timezone name is ignored. expect("2020-12-05T20:23:00.000Z").toBe( new Date( "Thu Dec 5 2020 12:23 -0800 (Whatever alpha 123 numerics or punctuation $# ({}[] works )" @@ -731,9 +665,7 @@ test("garbage", () => { // Accept punctuation at any point before time. // Firefox fails in some conditions before time. // Chrome is finnicky on interior punctuation. - expect("2204-01-20T02:32:00.000Z").toBe( - new Date("2204 //. -/, Jan ./- 20 ..- 10:32 GMT+08:00").toISOString() - ); + expect("2204-01-20T02:32:00.000Z").toBe(new Date("2204 //. -/, Jan ./- 20 ..- 10:32 GMT+08:00").toISOString()); // Chrome does not accept punctuation after time. Firefox accepts some. We accept punctuation. expect("2204-01-29T18:30:00.000Z").toBe(new Date("2204 Jan 29 10:30 /--/").toISOString()); @@ -756,18 +688,10 @@ test("multiple month names", () => { const originalTimeZone = setTimeZone("America/Vancouver"); // Multiple month names are accepted. Last one wins. - expect("1981-03-23T22:56:00.000Z").toBe( - new Date("March 23, 1981 14:56 GMT-08:00").toISOString() - ); - expect("1981-04-23T22:56:00.000Z").toBe( - new Date("March 23, Apr 1981 14:56 GMT-08:00").toISOString() - ); - expect("1981-05-23T22:56:00.000Z").toBe( - new Date("March 23, Apron 1981 mAY 14:56 GMT-08:00").toISOString() - ); - expect("1981-06-23T22:56:00.000Z").toBe( - new Date("March 23, Apron 1981 mAY 14:56 junuary GMT-08:00").toISOString() - ); + expect("1981-03-23T22:56:00.000Z").toBe(new Date("March 23, 1981 14:56 GMT-08:00").toISOString()); + expect("1981-04-23T22:56:00.000Z").toBe(new Date("March 23, Apr 1981 14:56 GMT-08:00").toISOString()); + expect("1981-05-23T22:56:00.000Z").toBe(new Date("March 23, Apron 1981 mAY 14:56 GMT-08:00").toISOString()); + expect("1981-06-23T22:56:00.000Z").toBe(new Date("March 23, Apron 1981 mAY 14:56 junuary GMT-08:00").toISOString()); expect("1981-07-23T22:56:00.000Z").toBe( new Date("March 23, Apron 1981 mAY 14:56 junuary GMT-08:00 Julie").toISOString() ); diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleDateString.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleDateString.js index c5c796e26d..320195b0ea 100644 --- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleDateString.js +++ b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleDateString.js @@ -45,12 +45,8 @@ describe("correct behavior", () => { }); test("dateStyle may be set", () => { - expect(d0.toLocaleDateString("en", { dateStyle: "full", timeZone: "UTC" })).toBe( - "Tuesday, December 7, 2021" - ); - expect(d1.toLocaleDateString("en", { dateStyle: "full", timeZone: "UTC" })).toBe( - "Monday, January 23, 1989" - ); + expect(d0.toLocaleDateString("en", { dateStyle: "full", timeZone: "UTC" })).toBe("Tuesday, December 7, 2021"); + expect(d1.toLocaleDateString("en", { dateStyle: "full", timeZone: "UTC" })).toBe("Monday, January 23, 1989"); expect(d0.toLocaleDateString("ar-u-nu-arab", { dateStyle: "full", timeZone: "UTC" })).toBe( "الثلاثاء، ٧ ديسمبر ٢٠٢١" diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleString.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleString.js index b75ff93a64..67786536e5 100644 --- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleString.js +++ b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleString.js @@ -34,35 +34,23 @@ describe("correct behavior", () => { expect(d0.toLocaleString("en", { timeZone: "UTC" })).toBe("12/7/2021, 5:40:50 PM"); expect(d1.toLocaleString("en", { timeZone: "UTC" })).toBe("1/23/1989, 7:08:09 AM"); - expect(d0.toLocaleString("ar-u-nu-arab", { timeZone: "UTC" })).toBe( - "٧‏/١٢‏/٢٠٢١، ٥:٤٠:٥٠ م" - ); - expect(d1.toLocaleString("ar-u-nu-arab", { timeZone: "UTC" })).toBe( - "٢٣‏/١‏/١٩٨٩، ٧:٠٨:٠٩ ص" - ); + expect(d0.toLocaleString("ar-u-nu-arab", { timeZone: "UTC" })).toBe("٧‏/١٢‏/٢٠٢١، ٥:٤٠:٥٠ م"); + expect(d1.toLocaleString("ar-u-nu-arab", { timeZone: "UTC" })).toBe("٢٣‏/١‏/١٩٨٩، ٧:٠٨:٠٩ ص"); }); test("dateStyle may be set", () => { expect(d0.toLocaleString("en", { dateStyle: "short", timeZone: "UTC" })).toBe("12/7/21"); expect(d1.toLocaleString("en", { dateStyle: "short", timeZone: "UTC" })).toBe("1/23/89"); - expect(d0.toLocaleString("ar-u-nu-arab", { dateStyle: "short", timeZone: "UTC" })).toBe( - "٧‏/١٢‏/٢٠٢١" - ); - expect(d1.toLocaleString("ar-u-nu-arab", { dateStyle: "short", timeZone: "UTC" })).toBe( - "٢٣‏/١‏/١٩٨٩" - ); + expect(d0.toLocaleString("ar-u-nu-arab", { dateStyle: "short", timeZone: "UTC" })).toBe("٧‏/١٢‏/٢٠٢١"); + expect(d1.toLocaleString("ar-u-nu-arab", { dateStyle: "short", timeZone: "UTC" })).toBe("٢٣‏/١‏/١٩٨٩"); }); test("timeStyle may be set", () => { expect(d0.toLocaleString("en", { timeStyle: "short", timeZone: "UTC" })).toBe("5:40 PM"); expect(d1.toLocaleString("en", { timeStyle: "short", timeZone: "UTC" })).toBe("7:08 AM"); - expect(d0.toLocaleString("ar-u-nu-arab", { timeStyle: "short", timeZone: "UTC" })).toBe( - "٥:٤٠ م" - ); - expect(d1.toLocaleString("ar-u-nu-arab", { timeStyle: "short", timeZone: "UTC" })).toBe( - "٧:٠٨ ص" - ); + expect(d0.toLocaleString("ar-u-nu-arab", { timeStyle: "short", timeZone: "UTC" })).toBe("٥:٤٠ م"); + expect(d1.toLocaleString("ar-u-nu-arab", { timeStyle: "short", timeZone: "UTC" })).toBe("٧:٠٨ ص"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleTimeString.js b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleTimeString.js index 2059428ff0..9e515355d8 100644 --- a/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleTimeString.js +++ b/Libraries/LibJS/Tests/builtins/Date/Date.prototype.toLocaleTimeString.js @@ -45,18 +45,10 @@ describe("correct behavior", () => { }); test("timeStyle may be set", () => { - expect(d0.toLocaleTimeString("en", { timeStyle: "long", timeZone: "UTC" })).toBe( - "5:40:50 PM UTC" - ); - expect(d1.toLocaleTimeString("en", { timeStyle: "long", timeZone: "UTC" })).toBe( - "7:08:09 AM UTC" - ); + expect(d0.toLocaleTimeString("en", { timeStyle: "long", timeZone: "UTC" })).toBe("5:40:50 PM UTC"); + expect(d1.toLocaleTimeString("en", { timeStyle: "long", timeZone: "UTC" })).toBe("7:08:09 AM UTC"); - expect(d0.toLocaleTimeString("ar-u-nu-arab", { timeStyle: "long", timeZone: "UTC" })).toBe( - "٥:٤٠:٥٠ م UTC" - ); - expect(d1.toLocaleTimeString("ar-u-nu-arab", { timeStyle: "long", timeZone: "UTC" })).toBe( - "٧:٠٨:٠٩ ص UTC" - ); + expect(d0.toLocaleTimeString("ar-u-nu-arab", { timeStyle: "long", timeZone: "UTC" })).toBe("٥:٤٠:٥٠ م UTC"); + expect(d1.toLocaleTimeString("ar-u-nu-arab", { timeStyle: "long", timeZone: "UTC" })).toBe("٧:٠٨:٠٩ ص UTC"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.move.js b/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.move.js index 9ed2a1f140..f8554b7d10 100644 --- a/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.move.js +++ b/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.move.js @@ -54,9 +54,6 @@ describe("throws errors", () => { stack.dispose(); expect(stack.disposed).toBeTrue(); - expect(() => stack.move()).toThrowWithMessage( - ReferenceError, - "DisposableStack already disposed values" - ); + expect(() => stack.move()).toThrowWithMessage(ReferenceError, "DisposableStack already disposed values"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.use.js b/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.use.js index 77224b130c..60c04cca4b 100644 --- a/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.use.js +++ b/Libraries/LibJS/Tests/builtins/DisposableStack/DisposableStack.prototype.use.js @@ -53,10 +53,7 @@ describe("throws errors", () => { test("if added object does not have a dispose method throws type error", () => { const stack = new DisposableStack(); [{}, [], { f() {} }].forEach(value => { - expect(() => stack.use(value)).toThrowWithMessage( - TypeError, - "does not have dispose method" - ); + expect(() => stack.use(value)).toThrowWithMessage(TypeError, "does not have dispose method"); }); expect(stack.disposed).toBeFalse(); diff --git a/Libraries/LibJS/Tests/builtins/FinalizationRegistry/FinalizationRegistry.js b/Libraries/LibJS/Tests/builtins/FinalizationRegistry/FinalizationRegistry.js index d4aacbbc24..d910f7804b 100644 --- a/Libraries/LibJS/Tests/builtins/FinalizationRegistry/FinalizationRegistry.js +++ b/Libraries/LibJS/Tests/builtins/FinalizationRegistry/FinalizationRegistry.js @@ -14,10 +14,7 @@ describe("errors", () => { test("called without new", () => { expect(() => { FinalizationRegistry(); - }).toThrowWithMessage( - TypeError, - "FinalizationRegistry constructor must be called with 'new'" - ); + }).toThrowWithMessage(TypeError, "FinalizationRegistry constructor must be called with 'new'"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Function/Function.js b/Libraries/LibJS/Tests/builtins/Function/Function.js index 2105a633ac..2de7cde413 100644 --- a/Libraries/LibJS/Tests/builtins/Function/Function.js +++ b/Libraries/LibJS/Tests/builtins/Function/Function.js @@ -21,12 +21,8 @@ describe("correct behavior", () => { expect(new Function("foo", "bar", "return foo + bar")(1, 2)).toBe(3); expect(new Function("foo", "bar,baz", "return foo + bar + baz")(1, 2, 3)).toBe(6); expect(new Function("foo", "bar", "baz", "return foo + bar + baz")(1, 2, 3)).toBe(6); - expect(new Function("foo", "if (foo) { return 42; } else { return 'bar'; }")(true)).toBe( - 42 - ); - expect(new Function("foo", "if (foo) { return 42; } else { return 'bar'; }")(false)).toBe( - "bar" - ); + expect(new Function("foo", "if (foo) { return 42; } else { return 'bar'; }")(true)).toBe(42); + expect(new Function("foo", "if (foo) { return 42; } else { return 'bar'; }")(false)).toBe("bar"); expect(new Function("return typeof Function()")()).toBe("function"); expect(new Function("x", "return function (y) { return x + y };")(1)(2)).toBe(3); @@ -49,10 +45,7 @@ describe("errors", () => { // FIXME: The position is odd though, I'd expect `line: 2, column: 2` and `line: 3, column: 1`... // > eval("\n[") // Uncaught exception: [SyntaxError] Unexpected token Eof. Expected BracketClose (line: 2, column: 2) // > eval("\n[\n") // Uncaught exception: [SyntaxError] Unexpected token Eof. Expected BracketClose (line: 2, column: 3) - .toThrowWithMessage( - SyntaxError, - "Unexpected token Eof. Expected BracketClose (line: 2, column: 3)" - ); + .toThrowWithMessage(SyntaxError, "Unexpected token Eof. Expected BracketClose (line: 2, column: 3)"); }); test("parameters and body must be valid standalone", () => { diff --git a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Function/Function.prototype.toString.js index 3fb6b96ab7..68816fba0a 100644 --- a/Libraries/LibJS/Tests/builtins/Function/Function.prototype.toString.js +++ b/Libraries/LibJS/Tests/builtins/Function/Function.prototype.toString.js @@ -39,12 +39,8 @@ describe("correct behavior", () => { expect({ *foo() {} }.foo.toString()).toBe("*foo() {}"); expect({ async foo() {} }.foo.toString()).toBe("async foo() {}"); expect({ async *foo() {} }.foo.toString()).toBe("async *foo() {}"); - expect(Object.getOwnPropertyDescriptor({ get foo() {} }, "foo").get.toString()).toBe( - "get foo() {}" - ); - expect(Object.getOwnPropertyDescriptor({ set foo(x) {} }, "foo").set.toString()).toBe( - "set foo(x) {}" - ); + expect(Object.getOwnPropertyDescriptor({ get foo() {} }, "foo").get.toString()).toBe("get foo() {}"); + expect(Object.getOwnPropertyDescriptor({ set foo(x) {} }, "foo").set.toString()).toBe("set foo(x) {}"); }); test("arrow function", () => { @@ -127,9 +123,9 @@ describe("correct behavior", () => { // Built-in functions expect(console.debug.toString()).toBe("function debug() { [native code] }"); expect(Function.toString()).toBe("function Function() { [native code] }"); - expect( - Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, "format").get.toString() - ).toBe("function get format() { [native code] }"); + expect(Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, "format").get.toString()).toBe( + "function get format() { [native code] }" + ); const values = [ // Callable Proxy diff --git a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.js b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.js index 7bc15f613f..063243a403 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.js @@ -51,10 +51,7 @@ describe("errors", () => { ["hello!", "+1", "+1:02", "+01:02:03"].forEach(timeZone => { expect(() => { new Intl.DateTimeFormat("en", { timeZone: timeZone }); - }).toThrowWithMessage( - RangeError, - `${timeZone} is not a valid value for option timeZone` - ); + }).toThrowWithMessage(RangeError, `${timeZone} is not a valid value for option timeZone`); }); }); @@ -65,10 +62,7 @@ describe("errors", () => { expect(() => { new Intl.DateTimeFormat("en", { era: "narrow", dateStyle: "long" }); - }).toThrowWithMessage( - TypeError, - "Option era cannot be set when also providing dateStyle or timeStyle" - ); + }).toThrowWithMessage(TypeError, "Option era cannot be set when also providing dateStyle or timeStyle"); }); test("year option is invalid", () => { @@ -78,10 +72,7 @@ describe("errors", () => { expect(() => { new Intl.DateTimeFormat("en", { year: "numeric", dateStyle: "long" }); - }).toThrowWithMessage( - TypeError, - "Option year cannot be set when also providing dateStyle or timeStyle" - ); + }).toThrowWithMessage(TypeError, "Option year cannot be set when also providing dateStyle or timeStyle"); }); test("month option is invalid", () => { @@ -91,10 +82,7 @@ describe("errors", () => { expect(() => { new Intl.DateTimeFormat("en", { month: "numeric", dateStyle: "long" }); - }).toThrowWithMessage( - TypeError, - "Option month cannot be set when also providing dateStyle or timeStyle" - ); + }).toThrowWithMessage(TypeError, "Option month cannot be set when also providing dateStyle or timeStyle"); }); test("weekday option is invalid", () => { @@ -104,10 +92,7 @@ describe("errors", () => { expect(() => { new Intl.DateTimeFormat("en", { weekday: "narrow", dateStyle: "long" }); - }).toThrowWithMessage( - TypeError, - "Option weekday cannot be set when also providing dateStyle or timeStyle" - ); + }).toThrowWithMessage(TypeError, "Option weekday cannot be set when also providing dateStyle or timeStyle"); }); test("day option is invalid", () => { @@ -117,10 +102,7 @@ describe("errors", () => { expect(() => { new Intl.DateTimeFormat("en", { day: "numeric", dateStyle: "long" }); - }).toThrowWithMessage( - TypeError, - "Option day cannot be set when also providing dateStyle or timeStyle" - ); + }).toThrowWithMessage(TypeError, "Option day cannot be set when also providing dateStyle or timeStyle"); }); test("dayPeriod option is invalid", () => { @@ -130,10 +112,7 @@ describe("errors", () => { expect(() => { new Intl.DateTimeFormat("en", { dayPeriod: "narrow", dateStyle: "long" }); - }).toThrowWithMessage( - TypeError, - "Option dayPeriod cannot be set when also providing dateStyle or timeStyle" - ); + }).toThrowWithMessage(TypeError, "Option dayPeriod cannot be set when also providing dateStyle or timeStyle"); }); test("hour option is invalid", () => { @@ -143,10 +122,7 @@ describe("errors", () => { expect(() => { new Intl.DateTimeFormat("en", { hour: "numeric", dateStyle: "long" }); - }).toThrowWithMessage( - TypeError, - "Option hour cannot be set when also providing dateStyle or timeStyle" - ); + }).toThrowWithMessage(TypeError, "Option hour cannot be set when also providing dateStyle or timeStyle"); }); test("minute option is invalid", () => { @@ -156,10 +132,7 @@ describe("errors", () => { expect(() => { new Intl.DateTimeFormat("en", { minute: "numeric", dateStyle: "long" }); - }).toThrowWithMessage( - TypeError, - "Option minute cannot be set when also providing dateStyle or timeStyle" - ); + }).toThrowWithMessage(TypeError, "Option minute cannot be set when also providing dateStyle or timeStyle"); }); test("second option is invalid", () => { @@ -169,10 +142,7 @@ describe("errors", () => { expect(() => { new Intl.DateTimeFormat("en", { second: "numeric", dateStyle: "long" }); - }).toThrowWithMessage( - TypeError, - "Option second cannot be set when also providing dateStyle or timeStyle" - ); + }).toThrowWithMessage(TypeError, "Option second cannot be set when also providing dateStyle or timeStyle"); }); test("fractionalSecondDigits option is invalid", () => { @@ -366,13 +336,11 @@ describe("normal behavior", () => { }); test("all valid timeZoneName options", () => { - ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"].forEach( - timeZoneName => { - expect(() => { - new Intl.DateTimeFormat("en", { timeZoneName: timeZoneName }); - }).not.toThrow(); - } - ); + ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"].forEach(timeZoneName => { + expect(() => { + new Intl.DateTimeFormat("en", { timeZoneName: timeZoneName }); + }).not.toThrow(); + }); }); test("all valid formatMatcher options", () => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js index f34f8616f9..981083241a 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js @@ -58,9 +58,7 @@ describe("errors", () => { ); expect(() => { - formatter.format( - new Temporal.PlainDateTime(1972, 1, 1, 8, 45, 56, 123, 345, 789, "gregory") - ); + formatter.format(new Temporal.PlainDateTime(1972, 1, 1, 8, 45, 56, 123, 345, 789, "gregory")); }).toThrowWithMessage( RangeError, "Cannot format Temporal.PlainDateTime with calendar 'gregory' in locale with calendar 'iso8601'" diff --git a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRange.js b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRange.js index 3b7fe4dddf..a1822141b2 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRange.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRange.js @@ -65,18 +65,7 @@ describe("errors", () => { ); expect(() => { - const plainDateTime = new Temporal.PlainDateTime( - 1972, - 1, - 1, - 8, - 45, - 56, - 123, - 345, - 789, - "gregory" - ); + const plainDateTime = new Temporal.PlainDateTime(1972, 1, 1, 8, 45, 56, 123, 345, 789, "gregory"); formatter.formatRange(plainDateTime, plainDateTime); }).toThrowWithMessage( RangeError, @@ -98,19 +87,13 @@ describe("errors", () => { expect(() => { const plainDate = new Temporal.PlainDate(1972, 1, 1, "gregory"); new Intl.DateTimeFormat().formatRange(plainDate, 0); - }).toThrowWithMessage( - TypeError, - "Cannot format a date-time range with different date-time types" - ); + }).toThrowWithMessage(TypeError, "Cannot format a date-time range with different date-time types"); expect(() => { const plainYearMonth = new Temporal.PlainYearMonth(1972, 1, "gregory"); const plainMonthDay = new Temporal.PlainMonthDay(1, 1, "gregory"); new Intl.DateTimeFormat().formatRange(plainYearMonth, plainMonthDay); - }).toThrowWithMessage( - TypeError, - "Cannot format a date-time range with different date-time types" - ); + }).toThrowWithMessage(TypeError, "Cannot format a date-time range with different date-time types"); }); test("Temporal fields must overlap formatter", () => { @@ -346,8 +329,6 @@ describe("Temporal objects", () => { test("Temporal.Instant", () => { const instant1 = new Temporal.Instant(601546251000000000n); const instant2 = new Temporal.Instant(1732740069000000000n); - expect(formatter.formatRange(instant1, instant2)).toBe( - "1989-01-23, 8:10:51 AM – 2024-11-27, 8:41:09 PM" - ); + expect(formatter.formatRange(instant1, instant2)).toBe("1989-01-23, 8:10:51 AM – 2024-11-27, 8:41:09 PM"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRangeToParts.js b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRangeToParts.js index d66faef2c2..5025de237b 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRangeToParts.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatRangeToParts.js @@ -65,18 +65,7 @@ describe("errors", () => { ); expect(() => { - const plainDateTime = new Temporal.PlainDateTime( - 1972, - 1, - 1, - 8, - 45, - 56, - 123, - 345, - 789, - "gregory" - ); + const plainDateTime = new Temporal.PlainDateTime(1972, 1, 1, 8, 45, 56, 123, 345, 789, "gregory"); formatter.formatRangeToParts(plainDateTime, plainDateTime); }).toThrowWithMessage( RangeError, @@ -98,19 +87,13 @@ describe("errors", () => { expect(() => { const plainDate = new Temporal.PlainDate(1972, 1, 1, "gregory"); new Intl.DateTimeFormat().formatRangeToParts(plainDate, 0); - }).toThrowWithMessage( - TypeError, - "Cannot format a date-time range with different date-time types" - ); + }).toThrowWithMessage(TypeError, "Cannot format a date-time range with different date-time types"); expect(() => { const plainYearMonth = new Temporal.PlainYearMonth(1972, 1, "gregory"); const plainMonthDay = new Temporal.PlainMonthDay(1, 1, "gregory"); new Intl.DateTimeFormat().formatRangeToParts(plainYearMonth, plainMonthDay); - }).toThrowWithMessage( - TypeError, - "Cannot format a date-time range with different date-time types" - ); + }).toThrowWithMessage(TypeError, "Cannot format a date-time range with different date-time types"); }); test("Temporal fields must overlap formatter", () => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatToParts.js b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatToParts.js index ed7137af97..c55eda8a67 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatToParts.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.formatToParts.js @@ -54,9 +54,7 @@ describe("errors", () => { ); expect(() => { - formatter.formatToParts( - new Temporal.PlainDateTime(1972, 1, 1, 8, 45, 56, 123, 345, 789, "gregory") - ); + formatter.formatToParts(new Temporal.PlainDateTime(1972, 1, 1, 8, 45, 56, 123, 345, 789, "gregory")); }).toThrowWithMessage( RangeError, "Cannot format Temporal.PlainDateTime with calendar 'gregory' in locale with calendar 'iso8601'" diff --git a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.resolvedOptions.js b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.resolvedOptions.js index d3b866e181..e2a10dfebd 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.resolvedOptions.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.resolvedOptions.js @@ -232,11 +232,9 @@ describe("correct behavior", () => { }); test("timeZoneName", () => { - ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"].forEach( - timeZoneName => { - const en = new Intl.DateTimeFormat("en", { timeZoneName: timeZoneName }); - expect(en.resolvedOptions().timeZoneName).toBe(timeZoneName); - } - ); + ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"].forEach(timeZoneName => { + const en = new Intl.DateTimeFormat("en", { timeZoneName: timeZoneName }); + expect(en.resolvedOptions().timeZoneName).toBe(timeZoneName); + }); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.supportedLocalesOf.js b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.supportedLocalesOf.js index 27cb059323..8a49f3ba1f 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.supportedLocalesOf.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.supportedLocalesOf.js @@ -21,9 +21,9 @@ describe("correct behavior", () => { for (const [input, expected] of values) { expect(Intl.DateTimeFormat.supportedLocalesOf(input)).toEqual(expected); // "best fit" (implementation defined) just uses the same implementation as "lookup" at the moment - expect( - Intl.DateTimeFormat.supportedLocalesOf(input, { localeMatcher: "best fit" }) - ).toEqual(Intl.DateTimeFormat.supportedLocalesOf(input, { localeMatcher: "lookup" })); + expect(Intl.DateTimeFormat.supportedLocalesOf(input, { localeMatcher: "best fit" })).toEqual( + Intl.DateTimeFormat.supportedLocalesOf(input, { localeMatcher: "lookup" }) + ); } }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.supportedLocalesOf.js b/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.supportedLocalesOf.js index a5d6ade92e..97c9c555b3 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.supportedLocalesOf.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DisplayNames/DisplayNames.supportedLocalesOf.js @@ -21,9 +21,9 @@ describe("correct behavior", () => { for (const [input, expected] of values) { expect(Intl.DisplayNames.supportedLocalesOf(input)).toEqual(expected); // "best fit" (implementation defined) just uses the same implementation as "lookup" at the moment - expect( - Intl.DisplayNames.supportedLocalesOf(input, { localeMatcher: "best fit" }) - ).toEqual(Intl.DisplayNames.supportedLocalesOf(input, { localeMatcher: "lookup" })); + expect(Intl.DisplayNames.supportedLocalesOf(input, { localeMatcher: "best fit" })).toEqual( + Intl.DisplayNames.supportedLocalesOf(input, { localeMatcher: "lookup" }) + ); } }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.js b/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.js index 97735be669..458c5ede10 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.js @@ -2,10 +2,7 @@ describe("errors", () => { test("called without new", () => { expect(() => { Intl.DurationFormat(); - }).toThrowWithMessage( - TypeError, - "Intl.DurationFormat constructor must be called with 'new'" - ); + }).toThrowWithMessage(TypeError, "Intl.DurationFormat constructor must be called with 'new'"); }); test("structurally invalid tag", () => { @@ -137,10 +134,7 @@ describe("errors", () => { test("millisecondsDisplay option is invalid", () => { expect(() => { new Intl.DurationFormat("en", { millisecondsDisplay: "hello!" }); - }).toThrowWithMessage( - RangeError, - "hello! is not a valid value for option millisecondsDisplay" - ); + }).toThrowWithMessage(RangeError, "hello! is not a valid value for option millisecondsDisplay"); }); test("microseconds option is invalid", () => { @@ -152,10 +146,7 @@ describe("errors", () => { test("microsecondsDisplay option is invalid", () => { expect(() => { new Intl.DurationFormat("en", { microsecondsDisplay: "hello!" }); - }).toThrowWithMessage( - RangeError, - "hello! is not a valid value for option microsecondsDisplay" - ); + }).toThrowWithMessage(RangeError, "hello! is not a valid value for option microsecondsDisplay"); }); test("nanoseconds option is invalid", () => { @@ -167,10 +158,7 @@ describe("errors", () => { test("nanosecondsDisplay option is invalid", () => { expect(() => { new Intl.DurationFormat("en", { nanosecondsDisplay: "hello!" }); - }).toThrowWithMessage( - RangeError, - "hello! is not a valid value for option nanosecondsDisplay" - ); + }).toThrowWithMessage(RangeError, "hello! is not a valid value for option nanosecondsDisplay"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.prototype.formatToParts.js b/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.prototype.formatToParts.js index df8467e149..d16031be3a 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.prototype.formatToParts.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.prototype.formatToParts.js @@ -211,33 +211,31 @@ describe("correct behavior", () => { { type: "integer", value: "9", unit: "nanosecond" }, { type: "unit", value: "ns", unit: "nanosecond" }, ]); - expect(new Intl.DurationFormat("en", { style: "digital" }).formatToParts(duration)).toEqual( - [ - { type: "integer", value: "1", unit: "year" }, - { type: "literal", value: " ", unit: "year" }, - { type: "unit", value: "yr", unit: "year" }, - { type: "literal", value: ", " }, - { type: "integer", value: "2", unit: "month" }, - { type: "literal", value: " ", unit: "month" }, - { type: "unit", value: "mths", unit: "month" }, - { type: "literal", value: ", " }, - { type: "integer", value: "3", unit: "week" }, - { type: "literal", value: " ", unit: "week" }, - { type: "unit", value: "wks", unit: "week" }, - { type: "literal", value: ", " }, - { type: "integer", value: "3", unit: "day" }, - { type: "literal", value: " ", unit: "day" }, - { type: "unit", value: "days", unit: "day" }, - { type: "literal", value: ", " }, - { type: "integer", value: "4", unit: "hour" }, - { type: "literal", value: ":" }, - { type: "integer", value: "05", unit: "minute" }, - { type: "literal", value: ":" }, - { type: "integer", value: "06", unit: "second" }, - { type: "decimal", value: ".", unit: "second" }, - { type: "fraction", value: "007008009", unit: "second" }, - ] - ); + expect(new Intl.DurationFormat("en", { style: "digital" }).formatToParts(duration)).toEqual([ + { type: "integer", value: "1", unit: "year" }, + { type: "literal", value: " ", unit: "year" }, + { type: "unit", value: "yr", unit: "year" }, + { type: "literal", value: ", " }, + { type: "integer", value: "2", unit: "month" }, + { type: "literal", value: " ", unit: "month" }, + { type: "unit", value: "mths", unit: "month" }, + { type: "literal", value: ", " }, + { type: "integer", value: "3", unit: "week" }, + { type: "literal", value: " ", unit: "week" }, + { type: "unit", value: "wks", unit: "week" }, + { type: "literal", value: ", " }, + { type: "integer", value: "3", unit: "day" }, + { type: "literal", value: " ", unit: "day" }, + { type: "unit", value: "days", unit: "day" }, + { type: "literal", value: ", " }, + { type: "integer", value: "4", unit: "hour" }, + { type: "literal", value: ":" }, + { type: "integer", value: "05", unit: "minute" }, + { type: "literal", value: ":" }, + { type: "integer", value: "06", unit: "second" }, + { type: "decimal", value: ".", unit: "second" }, + { type: "fraction", value: "007008009", unit: "second" }, + ]); expect( new Intl.DurationFormat("en", { style: "narrow", @@ -398,33 +396,31 @@ describe("correct behavior", () => { { type: "literal", value: " ", unit: "nanosecond" }, { type: "unit", value: "ns", unit: "nanosecond" }, ]); - expect(new Intl.DurationFormat("de", { style: "digital" }).formatToParts(duration)).toEqual( - [ - { type: "integer", value: "1", unit: "year" }, - { type: "literal", value: " ", unit: "year" }, - { type: "unit", value: "J", unit: "year" }, - { type: "literal", value: ", " }, - { type: "integer", value: "2", unit: "month" }, - { type: "literal", value: " ", unit: "month" }, - { type: "unit", value: "Mon.", unit: "month" }, - { type: "literal", value: ", " }, - { type: "integer", value: "3", unit: "week" }, - { type: "literal", value: " ", unit: "week" }, - { type: "unit", value: "Wo.", unit: "week" }, - { type: "literal", value: ", " }, - { type: "integer", value: "3", unit: "day" }, - { type: "literal", value: " ", unit: "day" }, - { type: "unit", value: "Tg.", unit: "day" }, - { type: "literal", value: " und " }, - { type: "integer", value: "4", unit: "hour" }, - { type: "literal", value: ":" }, - { type: "integer", value: "05", unit: "minute" }, - { type: "literal", value: ":" }, - { type: "integer", value: "06", unit: "second" }, - { type: "decimal", value: ",", unit: "second" }, - { type: "fraction", value: "007008009", unit: "second" }, - ] - ); + expect(new Intl.DurationFormat("de", { style: "digital" }).formatToParts(duration)).toEqual([ + { type: "integer", value: "1", unit: "year" }, + { type: "literal", value: " ", unit: "year" }, + { type: "unit", value: "J", unit: "year" }, + { type: "literal", value: ", " }, + { type: "integer", value: "2", unit: "month" }, + { type: "literal", value: " ", unit: "month" }, + { type: "unit", value: "Mon.", unit: "month" }, + { type: "literal", value: ", " }, + { type: "integer", value: "3", unit: "week" }, + { type: "literal", value: " ", unit: "week" }, + { type: "unit", value: "Wo.", unit: "week" }, + { type: "literal", value: ", " }, + { type: "integer", value: "3", unit: "day" }, + { type: "literal", value: " ", unit: "day" }, + { type: "unit", value: "Tg.", unit: "day" }, + { type: "literal", value: " und " }, + { type: "integer", value: "4", unit: "hour" }, + { type: "literal", value: ":" }, + { type: "integer", value: "05", unit: "minute" }, + { type: "literal", value: ":" }, + { type: "integer", value: "06", unit: "second" }, + { type: "decimal", value: ",", unit: "second" }, + { type: "fraction", value: "007008009", unit: "second" }, + ]); expect( new Intl.DurationFormat("de", { style: "narrow", diff --git a/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.supportedLocalesOf.js b/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.supportedLocalesOf.js index aa06862fd9..b0728ccd7d 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.supportedLocalesOf.js +++ b/Libraries/LibJS/Tests/builtins/Intl/DurationFormat/DurationFormat.supportedLocalesOf.js @@ -21,9 +21,9 @@ describe("correct behavior", () => { for (const [input, expected] of values) { expect(Intl.DurationFormat.supportedLocalesOf(input)).toEqual(expected); // "best fit" (implementation defined) just uses the same implementation as "lookup" at the moment - expect( - Intl.DurationFormat.supportedLocalesOf(input, { localeMatcher: "best fit" }) - ).toEqual(Intl.DurationFormat.supportedLocalesOf(input, { localeMatcher: "lookup" })); + expect(Intl.DurationFormat.supportedLocalesOf(input, { localeMatcher: "best fit" })).toEqual( + Intl.DurationFormat.supportedLocalesOf(input, { localeMatcher: "lookup" }) + ); } }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/Intl.getCanonicalLocales.js b/Libraries/LibJS/Tests/builtins/Intl/Intl.getCanonicalLocales.js index 1fde5a9b73..e6c47f7ced 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/Intl.getCanonicalLocales.js +++ b/Libraries/LibJS/Tests/builtins/Intl/Intl.getCanonicalLocales.js @@ -20,17 +20,11 @@ describe("errors", () => { test("duplicate variant subtags", () => { expect(() => { Intl.getCanonicalLocales("en-posix-POSIX"); - }).toThrowWithMessage( - RangeError, - "en-posix-POSIX is not a structurally valid language tag" - ); + }).toThrowWithMessage(RangeError, "en-posix-POSIX is not a structurally valid language tag"); expect(() => { Intl.getCanonicalLocales("en-POSIX-POSIX"); - }).toThrowWithMessage( - RangeError, - "en-POSIX-POSIX is not a structurally valid language tag" - ); + }).toThrowWithMessage(RangeError, "en-POSIX-POSIX is not a structurally valid language tag"); }); test("improperly placed separator", () => { @@ -70,10 +64,7 @@ describe("errors", () => { test("duplicate transformed extension variant subtags", () => { expect(() => { Intl.getCanonicalLocales("en-t-en-POSIX-POSIX"); - }).toThrowWithMessage( - RangeError, - "en-t-en-POSIX-POSIX is not a structurally valid language tag" - ); + }).toThrowWithMessage(RangeError, "en-t-en-POSIX-POSIX is not a structurally valid language tag"); }); }); @@ -111,9 +102,7 @@ describe("normal behavior", () => { test("duplicate Unicode locale extension keywords", () => { expect(Intl.getCanonicalLocales("en-us-u-1k-aaa-1k-bbb")).toEqual(["en-US-u-1k-aaa"]); - expect(Intl.getCanonicalLocales("en-us-u-1k-aaa-2k-ccc-1k-bbb")).toEqual([ - "en-US-u-1k-aaa-2k-ccc", - ]); + expect(Intl.getCanonicalLocales("en-us-u-1k-aaa-2k-ccc-1k-bbb")).toEqual(["en-US-u-1k-aaa-2k-ccc"]); }); test("canonicalize locale objects", () => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/ListFormat/ListFormat.supportedLocalesOf.js b/Libraries/LibJS/Tests/builtins/Intl/ListFormat/ListFormat.supportedLocalesOf.js index 3bd5550944..1c190c8ea0 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/ListFormat/ListFormat.supportedLocalesOf.js +++ b/Libraries/LibJS/Tests/builtins/Intl/ListFormat/ListFormat.supportedLocalesOf.js @@ -21,9 +21,9 @@ describe("correct behavior", () => { for (const [input, expected] of values) { expect(Intl.ListFormat.supportedLocalesOf(input)).toEqual(expected); // "best fit" (implementation defined) just uses the same implementation as "lookup" at the moment - expect( - Intl.ListFormat.supportedLocalesOf(input, { localeMatcher: "best fit" }) - ).toEqual(Intl.ListFormat.supportedLocalesOf(input, { localeMatcher: "lookup" })); + expect(Intl.ListFormat.supportedLocalesOf(input, { localeMatcher: "best fit" })).toEqual( + Intl.ListFormat.supportedLocalesOf(input, { localeMatcher: "lookup" }) + ); } }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.firstDayOfWeek.js b/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.firstDayOfWeek.js index 4fc9667111..06373f4525 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.firstDayOfWeek.js +++ b/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.firstDayOfWeek.js @@ -9,10 +9,7 @@ describe("errors", () => { [123456789, "a", "longerthan8chars"].forEach(value => { expect(() => { new Intl.Locale("en", { firstDayOfWeek: value }).firstDayOfWeek; - }).toThrowWithMessage( - RangeError, - `${value} is not a valid value for option firstDayOfWeek` - ); + }).toThrowWithMessage(RangeError, `${value} is not a valid value for option firstDayOfWeek`); }); }); }); @@ -27,20 +24,14 @@ describe("normal behavior", () => { expect(new Intl.Locale("en", { firstDayOfWeek: day }).firstDayOfWeek).toBe(day); expect(new Intl.Locale("en", { firstDayOfWeek: index }).firstDayOfWeek).toBe(day); - expect(new Intl.Locale("en-u-fw-mon", { firstDayOfWeek: day }).firstDayOfWeek).toBe( - day - ); - expect(new Intl.Locale("en-u-fw-mon", { firstDayOfWeek: index }).firstDayOfWeek).toBe( - day - ); + expect(new Intl.Locale("en-u-fw-mon", { firstDayOfWeek: day }).firstDayOfWeek).toBe(day); + expect(new Intl.Locale("en-u-fw-mon", { firstDayOfWeek: index }).firstDayOfWeek).toBe(day); }); }); test("non-standard options", () => { [100, Infinity, NaN, "hello", 152n, true].forEach(value => { - expect(new Intl.Locale("en", { firstDayOfWeek: value }).firstDayOfWeek).toBe( - value.toString() - ); + expect(new Intl.Locale("en", { firstDayOfWeek: value }).firstDayOfWeek).toBe(value.toString()); }); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.maximize.js b/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.maximize.js index 079f4e5d9e..0874d93db2 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.maximize.js +++ b/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.maximize.js @@ -26,7 +26,5 @@ test("normal behavior", () => { test("keywords are preserved", () => { expect(new Intl.Locale("en-u-ca-abc").maximize().toString()).toBe("en-Latn-US-u-ca-abc"); - expect(new Intl.Locale("en", { calendar: "abc" }).maximize().toString()).toBe( - "en-Latn-US-u-ca-abc" - ); + expect(new Intl.Locale("en", { calendar: "abc" }).maximize().toString()).toBe("en-Latn-US-u-ca-abc"); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.minimize.js b/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.minimize.js index a223828538..907d25d91f 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.minimize.js +++ b/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.minimize.js @@ -28,7 +28,5 @@ test("normal behavior", () => { test("keywords are preserved", () => { expect(new Intl.Locale("en-Latn-US-u-ca-abc").minimize().toString()).toBe("en-u-ca-abc"); - expect(new Intl.Locale("en-Latn-US", { calendar: "abc" }).minimize().toString()).toBe( - "en-u-ca-abc" - ); + expect(new Intl.Locale("en-Latn-US", { calendar: "abc" }).minimize().toString()).toBe("en-u-ca-abc"); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.numberingSystem.js b/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.numberingSystem.js index 897944b97b..25310f322e 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.numberingSystem.js +++ b/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.numberingSystem.js @@ -11,8 +11,6 @@ describe("normal behavior", () => { expect(new Intl.Locale("en").numberingSystem).toBeUndefined(); expect(new Intl.Locale("en-u-nu-abc").numberingSystem).toBe("abc"); expect(new Intl.Locale("en", { numberingSystem: "abc" }).numberingSystem).toBe("abc"); - expect(new Intl.Locale("en-u-nu-abc", { numberingSystem: "def" }).numberingSystem).toBe( - "def" - ); + expect(new Intl.Locale("en-u-nu-abc", { numberingSystem: "def" }).numberingSystem).toBe("def"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.variants.js b/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.variants.js index e0b60e5a7b..72c43f134a 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.variants.js +++ b/Libraries/LibJS/Tests/builtins/Intl/Locale/Locale.prototype.variants.js @@ -8,10 +8,7 @@ describe("errors", () => { test("duplicate variants", () => { expect(() => { new Intl.Locale("en-abcde-abcde"); - }).toThrowWithMessage( - RangeError, - "en-abcde-abcde is not a structurally valid language tag" - ); + }).toThrowWithMessage(RangeError, "en-abcde-abcde is not a structurally valid language tag"); expect(() => { new Intl.Locale("en", { variants: "abcde-abcde" }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.js b/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.js index 22ed4d99e3..349cd37a2f 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.js +++ b/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.js @@ -44,10 +44,7 @@ describe("errors", () => { test("currency option is undefined when required ", () => { expect(() => { new Intl.NumberFormat("en", { style: "currency" }); - }).toThrowWithMessage( - TypeError, - "Option currency must be defined when option style is currency" - ); + }).toThrowWithMessage(TypeError, "Option currency must be defined when option style is currency"); }); test("currency option is invalid ", () => { @@ -85,10 +82,7 @@ describe("errors", () => { expect(() => { new Intl.NumberFormat("en", { unit: "acre-per-bit-per-byte" }); - }).toThrowWithMessage( - RangeError, - "acre-per-bit-per-byte is not a valid value for option unit" - ); + }).toThrowWithMessage(RangeError, "acre-per-bit-per-byte is not a valid value for option unit"); }); test("unitDisplay option is invalid ", () => { @@ -218,10 +212,7 @@ describe("errors", () => { test("roundingPriority option is invalid", () => { expect(() => { new Intl.NumberFormat("en", { roundingPriority: "hello!" }); - }).toThrowWithMessage( - RangeError, - "hello! is not a valid value for option roundingPriority" - ); + }).toThrowWithMessage(RangeError, "hello! is not a valid value for option roundingPriority"); }); test("roundingMode option is invalid", () => { @@ -249,10 +240,7 @@ describe("errors", () => { expect(() => { new Intl.NumberFormat("en", { roundingIncrement: 5, minimumSignificantDigits: 1 }); - }).toThrowWithMessage( - TypeError, - "5 is not a valid rounding increment for rounding type significantDigits" - ); + }).toThrowWithMessage(TypeError, "5 is not a valid rounding increment for rounding type significantDigits"); expect(() => { new Intl.NumberFormat("en", { @@ -260,19 +248,13 @@ describe("errors", () => { minimumFractionDigits: 2, maximumFractionDigits: 3, }); - }).toThrowWithMessage( - RangeError, - "5 is not a valid rounding increment for inequal min/max fraction digits" - ); + }).toThrowWithMessage(RangeError, "5 is not a valid rounding increment for inequal min/max fraction digits"); }); test("trailingZeroDisplay option is invalid", () => { expect(() => { new Intl.NumberFormat("en", { trailingZeroDisplay: "hello!" }); - }).toThrowWithMessage( - RangeError, - "hello! is not a valid value for option trailingZeroDisplay" - ); + }).toThrowWithMessage(RangeError, "hello! is not a valid value for option trailingZeroDisplay"); }); }); @@ -434,33 +416,23 @@ describe("normal behavior", () => { }); test("all valid roundingMode options", () => { - [ - "ceil", - "floor", - "expand", - "trunc", - "halfCeil", - "halfFloor", - "halfExpand", - "halfTrunc", - "halfEven", - ].forEach(roundingMode => { - expect(() => { - new Intl.NumberFormat("en", { roundingMode: roundingMode }); - }).not.toThrow(); - }); - }); - - test("all valid roundingIncrement options", () => { - [1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000].forEach( - roundingIncrement => { + ["ceil", "floor", "expand", "trunc", "halfCeil", "halfFloor", "halfExpand", "halfTrunc", "halfEven"].forEach( + roundingMode => { expect(() => { - new Intl.NumberFormat("en", { roundingIncrement: roundingIncrement }); + new Intl.NumberFormat("en", { roundingMode: roundingMode }); }).not.toThrow(); } ); }); + test("all valid roundingIncrement options", () => { + [1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000].forEach(roundingIncrement => { + expect(() => { + new Intl.NumberFormat("en", { roundingIncrement: roundingIncrement }); + }).not.toThrow(); + }); + }); + test("all valid trailingZeroDisplay options", () => { ["auto", "stripIfInteger"].forEach(trailingZeroDisplay => { expect(() => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.format.js b/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.format.js index 8897351e5d..ef9c19bed9 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.format.js +++ b/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.format.js @@ -82,21 +82,11 @@ describe("style=decimal", () => { expect(en.format(12.3456)).toBe("12.3456"); expect(en.format(12.34567)).toBe("12.3457"); expect(en.format(12.34561)).toBe("12.3456"); - expect(en.format(0.00000000000000000000000000000123)).toBe( - "0.000000000000000000000000000001230" - ); - expect(en.format(-0.00000000000000000000000000000123)).toBe( - "-0.000000000000000000000000000001230" - ); - expect(en.format(12344501000000000000000000000000000)).toBe( - "12,344,500,000,000,000,000,000,000,000,000,000" - ); - expect(en.format(-12344501000000000000000000000000000)).toBe( - "-12,344,500,000,000,000,000,000,000,000,000,000" - ); - expect(en.format(12344501000000000000000000000000000n)).toBe( - "12,344,500,000,000,000,000,000,000,000,000,000" - ); + expect(en.format(0.00000000000000000000000000000123)).toBe("0.000000000000000000000000000001230"); + expect(en.format(-0.00000000000000000000000000000123)).toBe("-0.000000000000000000000000000001230"); + expect(en.format(12344501000000000000000000000000000)).toBe("12,344,500,000,000,000,000,000,000,000,000,000"); + expect(en.format(-12344501000000000000000000000000000)).toBe("-12,344,500,000,000,000,000,000,000,000,000,000"); + expect(en.format(12344501000000000000000000000000000n)).toBe("12,344,500,000,000,000,000,000,000,000,000,000"); expect(en.format(-12344501000000000000000000000000000n)).toBe( "-12,344,500,000,000,000,000,000,000,000,000,000" ); @@ -211,9 +201,7 @@ describe("style=decimal", () => { expect(ar.format(123)).toBe("\u0661\u0662\u0663\u0623\u0633\u0660"); expect(ar.format(1234)).toBe("\u0661\u066b\u0662\u0663\u0664\u0623\u0633\u0663"); expect(ar.format(12345)).toBe("\u0661\u0662\u066b\u0663\u0664\u0665\u0623\u0633\u0663"); - expect(ar.format(123456)).toBe( - "\u0661\u0662\u0663\u066b\u0664\u0665\u0666\u0623\u0633\u0663" - ); + expect(ar.format(123456)).toBe("\u0661\u0662\u0663\u066b\u0664\u0665\u0666\u0623\u0633\u0663"); expect(ar.format(1234567)).toBe("\u0661\u066b\u0662\u0663\u0665\u0623\u0633\u0666"); expect(ar.format(0.1)).toBe("\u0661\u0660\u0660\u0623\u0633\u061c-\u0663"); expect(ar.format(0.12)).toBe("\u0661\u0662\u0660\u0623\u0633\u061c-\u0663"); @@ -563,16 +551,10 @@ describe("style=decimal", () => { expect(nf("en", undefined, 2, undefined, 2).format(1.23)).toBe("1.2"); expect(nf("en", undefined, 3, undefined, 1).format(1.23)).toBe("1.2"); - expect(nf("ar-u-nu-arab", 2, undefined, 2, undefined).format(1)).toBe( - "\u0661\u066b\u0660\u0660" - ); + expect(nf("ar-u-nu-arab", 2, undefined, 2, undefined).format(1)).toBe("\u0661\u066b\u0660\u0660"); expect(nf("ar-u-nu-arab", 3, undefined, 1, undefined).format(1)).toBe("\u0661\u066b\u0660"); - expect(nf("ar-u-nu-arab", undefined, 2, undefined, 2).format(1.23)).toBe( - "\u0661\u066b\u0662" - ); - expect(nf("ar-u-nu-arab", undefined, 3, undefined, 1).format(1.23)).toBe( - "\u0661\u066b\u0662" - ); + expect(nf("ar-u-nu-arab", undefined, 2, undefined, 2).format(1.23)).toBe("\u0661\u066b\u0662"); + expect(nf("ar-u-nu-arab", undefined, 3, undefined, 1).format(1.23)).toBe("\u0661\u066b\u0662"); }); test("roundingPriority=morePrecision", () => { @@ -592,15 +574,9 @@ describe("style=decimal", () => { expect(nf("en", undefined, 3, undefined, 1).format(1.23)).toBe("1.23"); expect(nf("ar-u-nu-arab", 2, undefined, 2, undefined).format(1)).toBe("\u0661\u066b\u0660"); - expect(nf("ar-u-nu-arab", 3, undefined, 1, undefined).format(1)).toBe( - "\u0661\u066b\u0660\u0660" - ); - expect(nf("ar-u-nu-arab", undefined, 2, undefined, 2).format(1.23)).toBe( - "\u0661\u066b\u0662\u0663" - ); - expect(nf("ar-u-nu-arab", undefined, 3, undefined, 1).format(1.23)).toBe( - "\u0661\u066b\u0662\u0663" - ); + expect(nf("ar-u-nu-arab", 3, undefined, 1, undefined).format(1)).toBe("\u0661\u066b\u0660\u0660"); + expect(nf("ar-u-nu-arab", undefined, 2, undefined, 2).format(1.23)).toBe("\u0661\u066b\u0662\u0663"); + expect(nf("ar-u-nu-arab", undefined, 3, undefined, 1).format(1.23)).toBe("\u0661\u066b\u0662\u0663"); }); test("roundingMode=ceil", () => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.formatToParts.js b/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.formatToParts.js index 98ac2aef31..4f7ebdaec3 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.formatToParts.js +++ b/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.formatToParts.js @@ -301,9 +301,7 @@ describe("style=decimal", () => { expect(enIn.formatToParts(1234567)).toEqual([{ type: "integer", value: "1234567" }]); const ar = new Intl.NumberFormat("ar-u-nu-arab", { useGrouping: false }); - expect(ar.formatToParts(123456)).toEqual([ - { type: "integer", value: "\u0661\u0662\u0663\u0664\u0665\u0666" }, - ]); + expect(ar.formatToParts(123456)).toEqual([{ type: "integer", value: "\u0661\u0662\u0663\u0664\u0665\u0666" }]); expect(ar.formatToParts(1234567)).toEqual([ { type: "integer", value: "\u0661\u0662\u0663\u0664\u0665\u0666\u0667" }, ]); @@ -1623,9 +1621,7 @@ describe("bigint", () => { expect(en.formatToParts(123456n)).toEqual([{ type: "integer", value: "123456" }]); const ar = new Intl.NumberFormat("ar-u-nu-arab", { useGrouping: false }); - expect(ar.formatToParts(123456n)).toEqual([ - { type: "integer", value: "\u0661\u0662\u0663\u0664\u0665\u0666" }, - ]); + expect(ar.formatToParts(123456n)).toEqual([{ type: "integer", value: "\u0661\u0662\u0663\u0664\u0665\u0666" }]); }); test("significant digits", () => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.resolvedOptions.js b/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.resolvedOptions.js index 2a2d2079fe..be3ddf05e3 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.resolvedOptions.js +++ b/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.prototype.resolvedOptions.js @@ -346,32 +346,22 @@ describe("correct behavior", () => { const en1 = new Intl.NumberFormat("en"); expect(en1.resolvedOptions().roundingMode).toBe("halfExpand"); - [ - "ceil", - "floor", - "expand", - "trunc", - "halfCeil", - "halfFloor", - "halfExpand", - "halfTrunc", - "halfEven", - ].forEach(roundingMode => { - const en2 = new Intl.NumberFormat("en", { roundingMode: roundingMode }); - expect(en2.resolvedOptions().roundingMode).toBe(roundingMode); - }); + ["ceil", "floor", "expand", "trunc", "halfCeil", "halfFloor", "halfExpand", "halfTrunc", "halfEven"].forEach( + roundingMode => { + const en2 = new Intl.NumberFormat("en", { roundingMode: roundingMode }); + expect(en2.resolvedOptions().roundingMode).toBe(roundingMode); + } + ); }); test("rounding increment", () => { const en1 = new Intl.NumberFormat("en"); expect(en1.resolvedOptions().roundingIncrement).toBe(1); - [1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000].forEach( - roundingIncrement => { - const en2 = new Intl.NumberFormat("en", { roundingIncrement: roundingIncrement }); - expect(en2.resolvedOptions().roundingIncrement).toBe(roundingIncrement); - } - ); + [1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000].forEach(roundingIncrement => { + const en2 = new Intl.NumberFormat("en", { roundingIncrement: roundingIncrement }); + expect(en2.resolvedOptions().roundingIncrement).toBe(roundingIncrement); + }); }); test("trailing zero display", () => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.supportedLocalesOf.js b/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.supportedLocalesOf.js index 0272bc333c..312d08a555 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.supportedLocalesOf.js +++ b/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.supportedLocalesOf.js @@ -21,9 +21,9 @@ describe("correct behavior", () => { for (const [input, expected] of values) { expect(Intl.NumberFormat.supportedLocalesOf(input)).toEqual(expected); // "best fit" (implementation defined) just uses the same implementation as "lookup" at the moment - expect( - Intl.NumberFormat.supportedLocalesOf(input, { localeMatcher: "best fit" }) - ).toEqual(Intl.NumberFormat.supportedLocalesOf(input, { localeMatcher: "lookup" })); + expect(Intl.NumberFormat.supportedLocalesOf(input, { localeMatcher: "best fit" })).toEqual( + Intl.NumberFormat.supportedLocalesOf(input, { localeMatcher: "lookup" }) + ); } }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.js b/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.js index 6125594068..b4534c4c09 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.js +++ b/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.js @@ -126,10 +126,7 @@ describe("errors", () => { test("roundingPriority option is invalid", () => { expect(() => { new Intl.PluralRules("en", { roundingPriority: "hello!" }); - }).toThrowWithMessage( - RangeError, - "hello! is not a valid value for option roundingPriority" - ); + }).toThrowWithMessage(RangeError, "hello! is not a valid value for option roundingPriority"); }); test("roundingMode option is invalid", () => { @@ -157,10 +154,7 @@ describe("errors", () => { expect(() => { new Intl.PluralRules("en", { roundingIncrement: 5, minimumSignificantDigits: 1 }); - }).toThrowWithMessage( - TypeError, - "5 is not a valid rounding increment for rounding type significantDigits" - ); + }).toThrowWithMessage(TypeError, "5 is not a valid rounding increment for rounding type significantDigits"); expect(() => { new Intl.PluralRules("en", { @@ -168,19 +162,13 @@ describe("errors", () => { minimumFractionDigits: 2, maximumFractionDigits: 3, }); - }).toThrowWithMessage( - RangeError, - "5 is not a valid rounding increment for inequal min/max fraction digits" - ); + }).toThrowWithMessage(RangeError, "5 is not a valid rounding increment for inequal min/max fraction digits"); }); test("trailingZeroDisplay option is invalid", () => { expect(() => { new Intl.PluralRules("en", { trailingZeroDisplay: "hello!" }); - }).toThrowWithMessage( - RangeError, - "hello! is not a valid value for option trailingZeroDisplay" - ); + }).toThrowWithMessage(RangeError, "hello! is not a valid value for option trailingZeroDisplay"); }); }); @@ -262,33 +250,23 @@ describe("normal behavior", () => { }); test("all valid roundingMode options", () => { - [ - "ceil", - "floor", - "expand", - "trunc", - "halfCeil", - "halfFloor", - "halfExpand", - "halfTrunc", - "halfEven", - ].forEach(roundingMode => { - expect(() => { - new Intl.PluralRules("en", { roundingMode: roundingMode }); - }).not.toThrow(); - }); - }); - - test("all valid roundingIncrement options", () => { - [1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000].forEach( - roundingIncrement => { + ["ceil", "floor", "expand", "trunc", "halfCeil", "halfFloor", "halfExpand", "halfTrunc", "halfEven"].forEach( + roundingMode => { expect(() => { - new Intl.PluralRules("en", { roundingIncrement: roundingIncrement }); + new Intl.PluralRules("en", { roundingMode: roundingMode }); }).not.toThrow(); } ); }); + test("all valid roundingIncrement options", () => { + [1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000].forEach(roundingIncrement => { + expect(() => { + new Intl.PluralRules("en", { roundingIncrement: roundingIncrement }); + }).not.toThrow(); + }); + }); + test("all valid trailingZeroDisplay options", () => { ["auto", "stripIfInteger"].forEach(trailingZeroDisplay => { expect(() => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.prototype.resolvedOptions.js b/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.prototype.resolvedOptions.js index 5062354bd2..100e202dc7 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.prototype.resolvedOptions.js +++ b/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.prototype.resolvedOptions.js @@ -116,32 +116,22 @@ describe("correct behavior", () => { const en1 = new Intl.PluralRules("en"); expect(en1.resolvedOptions().roundingMode).toBe("halfExpand"); - [ - "ceil", - "floor", - "expand", - "trunc", - "halfCeil", - "halfFloor", - "halfExpand", - "halfTrunc", - "halfEven", - ].forEach(roundingMode => { - const en2 = new Intl.PluralRules("en", { roundingMode: roundingMode }); - expect(en2.resolvedOptions().roundingMode).toBe(roundingMode); - }); + ["ceil", "floor", "expand", "trunc", "halfCeil", "halfFloor", "halfExpand", "halfTrunc", "halfEven"].forEach( + roundingMode => { + const en2 = new Intl.PluralRules("en", { roundingMode: roundingMode }); + expect(en2.resolvedOptions().roundingMode).toBe(roundingMode); + } + ); }); test("rounding increment", () => { const en1 = new Intl.PluralRules("en"); expect(en1.resolvedOptions().roundingIncrement).toBe(1); - [1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000].forEach( - roundingIncrement => { - const en2 = new Intl.PluralRules("en", { roundingIncrement: roundingIncrement }); - expect(en2.resolvedOptions().roundingIncrement).toBe(roundingIncrement); - } - ); + [1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000, 2500, 5000].forEach(roundingIncrement => { + const en2 = new Intl.PluralRules("en", { roundingIncrement: roundingIncrement }); + expect(en2.resolvedOptions().roundingIncrement).toBe(roundingIncrement); + }); }); test("trailing zero display", () => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.supportedLocalesOf.js b/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.supportedLocalesOf.js index 190d36e8ba..9d80f1af3c 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.supportedLocalesOf.js +++ b/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.supportedLocalesOf.js @@ -21,9 +21,9 @@ describe("correct behavior", () => { for (const [input, expected] of values) { expect(Intl.PluralRules.supportedLocalesOf(input)).toEqual(expected); // "best fit" (implementation defined) just uses the same implementation as "lookup" at the moment - expect( - Intl.PluralRules.supportedLocalesOf(input, { localeMatcher: "best fit" }) - ).toEqual(Intl.PluralRules.supportedLocalesOf(input, { localeMatcher: "lookup" })); + expect(Intl.PluralRules.supportedLocalesOf(input, { localeMatcher: "best fit" })).toEqual( + Intl.PluralRules.supportedLocalesOf(input, { localeMatcher: "lookup" }) + ); } }); }); diff --git a/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.js b/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.js index cb10a4497a..0f2fc9f557 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.js +++ b/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.js @@ -2,10 +2,7 @@ describe("errors", () => { test("called without new", () => { expect(() => { Intl.RelativeTimeFormat(); - }).toThrowWithMessage( - TypeError, - "Intl.RelativeTimeFormat constructor must be called with 'new'" - ); + }).toThrowWithMessage(TypeError, "Intl.RelativeTimeFormat constructor must be called with 'new'"); }); test("structurally invalid tag", () => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.prototype.formatToParts.js b/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.prototype.formatToParts.js index d9adc0f169..c5b61bf0f5 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.prototype.formatToParts.js +++ b/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.prototype.formatToParts.js @@ -61,9 +61,7 @@ describe("correct behavior", () => { { type: "literal", value: " seconds" }, ]); - expect(ar.formatToParts(-1, "second")).toEqual([ - { type: "literal", value: "قبل ثانية واحدة" }, - ]); + expect(ar.formatToParts(-1, "second")).toEqual([{ type: "literal", value: "قبل ثانية واحدة" }]); }); test("minute", () => { @@ -73,9 +71,7 @@ describe("correct behavior", () => { { type: "literal", value: " minutes" }, ]); - expect(ar.formatToParts(-1, "minute")).toEqual([ - { type: "literal", value: "قبل دقيقة واحدة" }, - ]); + expect(ar.formatToParts(-1, "minute")).toEqual([{ type: "literal", value: "قبل دقيقة واحدة" }]); }); test("hour", () => { @@ -85,9 +81,7 @@ describe("correct behavior", () => { { type: "literal", value: " hours" }, ]); - expect(ar.formatToParts(-1, "hour")).toEqual([ - { type: "literal", value: "قبل ساعة واحدة" }, - ]); + expect(ar.formatToParts(-1, "hour")).toEqual([{ type: "literal", value: "قبل ساعة واحدة" }]); }); test("day", () => { @@ -107,9 +101,7 @@ describe("correct behavior", () => { { type: "literal", value: " weeks" }, ]); - expect(ar.formatToParts(-1, "week")).toEqual([ - { type: "literal", value: "الأسبوع الماضي" }, - ]); + expect(ar.formatToParts(-1, "week")).toEqual([{ type: "literal", value: "الأسبوع الماضي" }]); }); test("month", () => { @@ -129,9 +121,7 @@ describe("correct behavior", () => { { type: "literal", value: " quarters" }, ]); - expect(ar.formatToParts(-1, "quarter")).toEqual([ - { type: "literal", value: "الربع الأخير" }, - ]); + expect(ar.formatToParts(-1, "quarter")).toEqual([{ type: "literal", value: "الربع الأخير" }]); }); test("year", () => { diff --git a/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.supportedLocalesOf.js b/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.supportedLocalesOf.js index d06b93850a..57ed8b4bce 100644 --- a/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.supportedLocalesOf.js +++ b/Libraries/LibJS/Tests/builtins/Intl/RelativeTimeFormat/RelativeTimeFormat.supportedLocalesOf.js @@ -21,9 +21,7 @@ describe("correct behavior", () => { for (const [input, expected] of values) { expect(Intl.RelativeTimeFormat.supportedLocalesOf(input)).toEqual(expected); // "best fit" (implementation defined) just uses the same implementation as "lookup" at the moment - expect( - Intl.RelativeTimeFormat.supportedLocalesOf(input, { localeMatcher: "best fit" }) - ).toEqual( + expect(Intl.RelativeTimeFormat.supportedLocalesOf(input, { localeMatcher: "best fit" })).toEqual( Intl.RelativeTimeFormat.supportedLocalesOf(input, { localeMatcher: "lookup" }) ); } diff --git a/Libraries/LibJS/Tests/builtins/Iterator/Iterator.prototype.@@toStringTag.js b/Libraries/LibJS/Tests/builtins/Iterator/Iterator.prototype.@@toStringTag.js index ba1a8f4352..5dbedc33d7 100644 --- a/Libraries/LibJS/Tests/builtins/Iterator/Iterator.prototype.@@toStringTag.js +++ b/Libraries/LibJS/Tests/builtins/Iterator/Iterator.prototype.@@toStringTag.js @@ -12,10 +12,7 @@ describe("errors", () => { test("cannot set the built-in Iterator's toStringTag", () => { expect(() => { Iterator.prototype[Symbol.toStringTag] = sentinel; - }).toThrowWithMessage( - TypeError, - "Cannot write to non-writable property '[object IteratorPrototype]'" - ); + }).toThrowWithMessage(TypeError, "Cannot write to non-writable property '[object IteratorPrototype]'"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Iterator/Iterator.prototype.constructor.js b/Libraries/LibJS/Tests/builtins/Iterator/Iterator.prototype.constructor.js index af8cde857a..20aa6bd932 100644 --- a/Libraries/LibJS/Tests/builtins/Iterator/Iterator.prototype.constructor.js +++ b/Libraries/LibJS/Tests/builtins/Iterator/Iterator.prototype.constructor.js @@ -12,10 +12,7 @@ describe("errors", () => { test("cannot set the built-in Iterator's constructor", () => { expect(() => { Iterator.prototype.constructor = sentinel; - }).toThrowWithMessage( - TypeError, - "Cannot write to non-writable property '[object IteratorPrototype]'" - ); + }).toThrowWithMessage(TypeError, "Cannot write to non-writable property '[object IteratorPrototype]'"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.parse-reviver.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.parse-reviver.js index 4044e0200a..20ab14262b 100644 --- a/Libraries/LibJS/Tests/builtins/JSON/JSON.parse-reviver.js +++ b/Libraries/LibJS/Tests/builtins/JSON/JSON.parse-reviver.js @@ -1,9 +1,7 @@ test("basic functionality", () => { let string = `{"var1":10,"var2":"hello","var3":{"nested":5}}`; - let object = JSON.parse(string, (key, value) => - typeof value === "number" ? value * 2 : value - ); + let object = JSON.parse(string, (key, value) => (typeof value === "number" ? value * 2 : value)); expect(object).toEqual({ var1: 20, var2: "hello", var3: { nested: 10 } }); object = JSON.parse(string, (key, value) => (typeof value === "number" ? undefined : value)); diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.rawJSON.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.rawJSON.js index b8a5629613..4d1bbf0cf2 100644 --- a/Libraries/LibJS/Tests/builtins/JSON/JSON.rawJSON.js +++ b/Libraries/LibJS/Tests/builtins/JSON/JSON.rawJSON.js @@ -17,19 +17,12 @@ test("JSON.rawJSON basic functionality", () => { expect(JSON.stringify({ 42: JSON.rawJSON(37) })).toBe('{"42":37}'); expect(JSON.stringify({ x: JSON.rawJSON(1), y: JSON.rawJSON(2) })).toBe('{"x":1,"y":2}'); - expect(JSON.stringify({ x: { x: JSON.rawJSON(1), y: JSON.rawJSON(2) } })).toBe( - '{"x":{"x":1,"y":2}}' - ); + expect(JSON.stringify({ x: { x: JSON.rawJSON(1), y: JSON.rawJSON(2) } })).toBe('{"x":{"x":1,"y":2}}'); expect(JSON.stringify([JSON.rawJSON(1), JSON.rawJSON(1.1)])).toBe("[1,1.1]"); - expect( - JSON.stringify([ - JSON.rawJSON('"1"'), - JSON.rawJSON(true), - JSON.rawJSON(null), - JSON.rawJSON(false), - ]) - ).toBe('["1",true,null,false]'); + expect(JSON.stringify([JSON.rawJSON('"1"'), JSON.rawJSON(true), JSON.rawJSON(null), JSON.rawJSON(false)])).toBe( + '["1",true,null,false]' + ); expect(JSON.stringify([{ x: JSON.rawJSON(1), y: JSON.rawJSON(1) }])).toBe('[{"x":1,"y":1}]'); }); diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-order.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-order.js index 3c2c8e3161..3edede22f1 100644 --- a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-order.js +++ b/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-order.js @@ -24,7 +24,5 @@ test("basic functionality", () => { o.key1 = "key1"; - expect(JSON.stringify(o)).toBe( - '{"0":0,"1":1,"2":2,"key2":"key2","defined":"defined","key4":"key4","key1":"key1"}' - ); + expect(JSON.stringify(o)).toBe('{"0":0,"1":1,"2":2,"key2":"key2","defined":"defined","key4":"key4","key1":"key1"}'); }); diff --git a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-replacer.js b/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-replacer.js index 156edffee7..731eb9634c 100644 --- a/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-replacer.js +++ b/Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-replacer.js @@ -26,9 +26,7 @@ test("basic functionality", () => { return value; }); - expect(string).toBe( - '{"var1":"foo","var2":42,"arr":[1,2,{"nested":{},"x":20}],"obj":{"subarr":[3,4,5]}}' - ); + expect(string).toBe('{"var1":"foo","var2":42,"arr":[1,2,{"nested":{},"x":20}],"obj":{"subarr":[3,4,5]}}'); string = JSON.stringify(o, ["var1", "var1", "var2", "obj"]); expect(string).toBe('{"var1":"foo","var2":42,"obj":{}}'); diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.sumPrecise.js b/Libraries/LibJS/Tests/builtins/Math/Math.sumPrecise.js index 464cc7f0d2..5796397525 100644 --- a/Libraries/LibJS/Tests/builtins/Math/Math.sumPrecise.js +++ b/Libraries/LibJS/Tests/builtins/Math/Math.sumPrecise.js @@ -8,89 +8,72 @@ test("basic functionality", () => { expect(Math.sumPrecise([0.1])).toBe(0.1); expect(Math.sumPrecise([0.1, 0.1])).toBe(0.2); expect(Math.sumPrecise([0.1, -0.1])).toBe(0); - expect(Math.sumPrecise([1e308, 1e308, 0.1, 0.1, 1e30, 0.1, -1e30, -1e308, -1e308])).toBe( - 0.30000000000000004 - ); + expect(Math.sumPrecise([1e308, 1e308, 0.1, 0.1, 1e30, 0.1, -1e30, -1e308, -1e308])).toBe(0.30000000000000004); expect(Math.sumPrecise([1e30, 0.1, -1e30])).toBe(0.1); - expect( - Math.sumPrecise([8.98846567431158e307, 8.988465674311579e307, -1.7976931348623157e308]) - ).toBe(9.9792015476736e291); - expect( - Math.sumPrecise([-5.630637621603525e255, 9.565271205476345e307, 2.9937604643020797e292]) - ).toBe(9.565271205476347e307); + expect(Math.sumPrecise([8.98846567431158e307, 8.988465674311579e307, -1.7976931348623157e308])).toBe( + 9.9792015476736e291 + ); + expect(Math.sumPrecise([-5.630637621603525e255, 9.565271205476345e307, 2.9937604643020797e292])).toBe( + 9.565271205476347e307 + ); expect( Math.sumPrecise([ - 6.739986666787661e66, 2, -1.2689709186578243e-116, 1.7046015739467354e308, - -9.979201547673601e291, 6.160926733208294e307, -3.179557053031852e234, - -7.027282978772846e307, -0.7500000000000001, + 6.739986666787661e66, 2, -1.2689709186578243e-116, 1.7046015739467354e308, -9.979201547673601e291, + 6.160926733208294e307, -3.179557053031852e234, -7.027282978772846e307, -0.7500000000000001, ]) ).toBe(1.61796594939028e308); expect( Math.sumPrecise([ - 0.31150493246968836, -8.988465674311582e307, 1.8315037361673755e-270, - -15.999999999999996, 2.9999999999999996, 7.345200721499384e164, -2.033582473639399, - -8.98846567431158e307, -3.5737295155405993e292, 4.13894772383715e-124, - -3.6111186457260667e-35, 2.387234887098013e180, 7.645295562778372e-298, - 3.395189016861822e-103, -2.6331611115768973e-149, + 0.31150493246968836, -8.988465674311582e307, 1.8315037361673755e-270, -15.999999999999996, + 2.9999999999999996, 7.345200721499384e164, -2.033582473639399, -8.98846567431158e307, + -3.5737295155405993e292, 4.13894772383715e-124, -3.6111186457260667e-35, 2.387234887098013e180, + 7.645295562778372e-298, 3.395189016861822e-103, -2.6331611115768973e-149, ]) ).toBe(-Infinity); expect( Math.sumPrecise([ - -1.1442589134409902e308, 9.593842098384855e138, 4.494232837155791e307, - -1.3482698511467367e308, 4.494232837155792e307, + -1.1442589134409902e308, 9.593842098384855e138, 4.494232837155791e307, -1.3482698511467367e308, + 4.494232837155792e307, ]) ).toBe(-1.5936821971565685e308); expect( Math.sumPrecise([ - -1.1442589134409902e308, 4.494232837155791e307, -1.3482698511467367e308, - 4.494232837155792e307, + -1.1442589134409902e308, 4.494232837155791e307, -1.3482698511467367e308, 4.494232837155792e307, ]) ).toBe(-1.5936821971565687e308); expect( - Math.sumPrecise([ - 9.593842098384855e138, -6.948356297254111e307, -1.3482698511467367e308, - 4.494232837155792e307, - ]) + Math.sumPrecise([9.593842098384855e138, -6.948356297254111e307, -1.3482698511467367e308, 4.494232837155792e307]) ).toBe(-1.5936821971565685e308); expect( Math.sumPrecise([-2.534858246857893e115, 8.988465674311579e307, 8.98846567431158e307]), 1.7976931348623157e308 ); + expect(Math.sumPrecise([1.3588124894186193e308, 1.4803986201152006e223, 6.741349255733684e307])).toBe(Infinity); + expect(Math.sumPrecise([6.741349255733684e307, 1.7976931348623155e308, -7.388327292663961e41])).toBe(Infinity); + expect(Math.sumPrecise([-1.9807040628566093e28, 1.7976931348623157e308, 9.9792015476736e291])).toBe( + 1.7976931348623157e308 + ); expect( - Math.sumPrecise([1.3588124894186193e308, 1.4803986201152006e223, 6.741349255733684e307]) - ).toBe(Infinity); - expect( - Math.sumPrecise([6.741349255733684e307, 1.7976931348623155e308, -7.388327292663961e41]) - ).toBe(Infinity); - expect( - Math.sumPrecise([-1.9807040628566093e28, 1.7976931348623157e308, 9.9792015476736e291]) + Math.sumPrecise([-1.0214557991173964e61, 1.7976931348623157e308, 8.98846567431158e307, -8.988465674311579e307]) ).toBe(1.7976931348623157e308); expect( Math.sumPrecise([ - -1.0214557991173964e61, 1.7976931348623157e308, 8.98846567431158e307, - -8.988465674311579e307, - ]) - ).toBe(1.7976931348623157e308); - expect( - Math.sumPrecise([ - 1.7976931348623157e308, 7.999999999999999, -1.908963895403937e-230, - 1.6445950082320264e292, 2.0734856707605806e205, + 1.7976931348623157e308, 7.999999999999999, -1.908963895403937e-230, 1.6445950082320264e292, + 2.0734856707605806e205, ]) ).toBe(Infinity); - expect( - Math.sumPrecise([6.197409167220438e-223, -9.979201547673601e291, -1.7976931348623157e308]) - ).toBe(-Infinity); + expect(Math.sumPrecise([6.197409167220438e-223, -9.979201547673601e291, -1.7976931348623157e308])).toBe(-Infinity); expect( Math.sumPrecise([ - 4.49423283715579e307, 8.944251746776101e307, -0.0002441406250000001, - 1.1752060710043817e308, 4.940846717201632e292, -1.6836699406454528e308, + 4.49423283715579e307, 8.944251746776101e307, -0.0002441406250000001, 1.1752060710043817e308, + 4.940846717201632e292, -1.6836699406454528e308, ]) ).toBe(8.353845887521184e307); expect( Math.sumPrecise([ - 8.988465674311579e307, 7.999999999999998, 7.029158107234023e-308, - -2.2303483759420562e-172, -1.7976931348623157e308, -8.98846567431158e307, + 8.988465674311579e307, 7.999999999999998, 7.029158107234023e-308, -2.2303483759420562e-172, + -1.7976931348623157e308, -8.98846567431158e307, ]) ).toBe(-1.7976931348623157e308); expect(Math.sumPrecise([8.98846567431158e307, 8.98846567431158e307])).toBe(Infinity); diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toLocaleString.js b/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toLocaleString.js index b481dbe4c8..49504d69bf 100644 --- a/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toLocaleString.js +++ b/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toLocaleString.js @@ -37,9 +37,7 @@ describe("styles", () => { test("percent", () => { expect((0.234).toLocaleString("en", { style: "percent" })).toBe("23%"); - expect((0.234).toLocaleString("ar-u-nu-arab", { style: "percent" })).toBe( - "\u0662\u0663\u066a\u061c" - ); + expect((0.234).toLocaleString("ar-u-nu-arab", { style: "percent" })).toBe("\u0662\u0663\u066a\u061c"); }); test("currency", () => { diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toPrecision.js b/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toPrecision.js index c2be588062..6dbcfd03fc 100644 --- a/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toPrecision.js +++ b/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toPrecision.js @@ -21,10 +21,7 @@ describe("errors", () => { [-Infinity, 0, 101, Infinity].forEach(value => { expect(() => { (0).toPrecision(value); - }).toThrowWithMessage( - RangeError, - "Precision must be an integer no less than 1, and no greater than 100" - ); + }).toThrowWithMessage(RangeError, "Precision must be an integer no less than 1, and no greater than 100"); }); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toString.js index e448b4cbc8..5e1d5e5402 100644 --- a/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toString.js +++ b/Libraries/LibJS/Tests/builtins/Number/Number.prototype.toString.js @@ -86,10 +86,7 @@ describe("correct behavior", () => { 3, "122200222200200002020000221212111212020212021222122122201112112001202200202210122011020121220102211210120110", ], - [ - 4, - "11323100002023111300233213100000000000000000000000000000000000000000000000000000000000", - ], + [4, "11323100002023111300233213100000000000000000000000000000000000000000000000000000000000"], [5, "20213333043100433442123113244334300004432332001224240433304410013422100304"], [6, "550003524220341511224004404200404220224024020444420402442220220420"], [7, "4235625635040541506562064422461122351652161506062250163366335"], diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.assign.js b/Libraries/LibJS/Tests/builtins/Object/Object.assign.js index 61b00fe870..fde1127a7f 100644 --- a/Libraries/LibJS/Tests/builtins/Object/Object.assign.js +++ b/Libraries/LibJS/Tests/builtins/Object/Object.assign.js @@ -29,14 +29,11 @@ describe("normal behavior", () => { test("merges objects", () => { const s = Symbol(); - expect( - Object.assign( - {}, - { foo: 0, bar: "baz" }, - { [s]: [1, 2, 3] }, - { foo: 1 }, - { [42]: "test" } - ) - ).toEqual({ foo: 1, bar: "baz", [s]: [1, 2, 3], 42: "test" }); + expect(Object.assign({}, { foo: 0, bar: "baz" }, { [s]: [1, 2, 3] }, { foo: 1 }, { [42]: "test" })).toEqual({ + foo: 1, + bar: "baz", + [s]: [1, 2, 3], + 42: "test", + }); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.create.js b/Libraries/LibJS/Tests/builtins/Object/Object.create.js index 6f1b4e0e34..3f60b0eb56 100644 --- a/Libraries/LibJS/Tests/builtins/Object/Object.create.js +++ b/Libraries/LibJS/Tests/builtins/Object/Object.create.js @@ -4,10 +4,7 @@ test("length is 2", () => { describe("errors", () => { test("non-object prototype value", () => { - expect(() => Object.create(42)).toThrowWithMessage( - TypeError, - "Prototype must be an object or null" - ); + expect(() => Object.create(42)).toThrowWithMessage(TypeError, "Prototype must be an object or null"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.defineProperties.js b/Libraries/LibJS/Tests/builtins/Object/Object.defineProperties.js index d0fb52b0fd..3b31c95eed 100644 --- a/Libraries/LibJS/Tests/builtins/Object/Object.defineProperties.js +++ b/Libraries/LibJS/Tests/builtins/Object/Object.defineProperties.js @@ -4,10 +4,7 @@ test("length is 2", () => { describe("errors", () => { test("non-object argument", () => { - expect(() => Object.defineProperties(42, {})).toThrowWithMessage( - TypeError, - "Object argument is not an object" - ); + expect(() => Object.defineProperties(42, {})).toThrowWithMessage(TypeError, "Object argument is not an object"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.defineProperty.js b/Libraries/LibJS/Tests/builtins/Object/Object.defineProperty.js index 84259b9258..ec3eca0f9a 100644 --- a/Libraries/LibJS/Tests/builtins/Object/Object.defineProperty.js +++ b/Libraries/LibJS/Tests/builtins/Object/Object.defineProperty.js @@ -188,10 +188,7 @@ describe("errors", () => { get() {}, value: 9, }); - }).toThrowWithMessage( - TypeError, - "Accessor property descriptor cannot specify a value or writable key" - ); + }).toThrowWithMessage(TypeError, "Accessor property descriptor cannot specify a value or writable key"); }); test("cannot define 'value' and 'set' in the same descriptor", () => { @@ -202,10 +199,7 @@ describe("errors", () => { set() {}, writable: true, }); - }).toThrowWithMessage( - TypeError, - "Accessor property descriptor cannot specify a value or writable key" - ); + }).toThrowWithMessage(TypeError, "Accessor property descriptor cannot specify a value or writable key"); }); test("redefine non-configurable accessor", () => { diff --git a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.constructor.js b/Libraries/LibJS/Tests/builtins/Object/Object.prototype.constructor.js index 50e4935c75..3eefd91eea 100644 --- a/Libraries/LibJS/Tests/builtins/Object/Object.prototype.constructor.js +++ b/Libraries/LibJS/Tests/builtins/Object/Object.prototype.constructor.js @@ -1,8 +1,7 @@ test("basic functionality", () => { [Array, BigInt, Boolean, Date, Error, Function, Number, Object, String].forEach(constructor => { expect(constructor.prototype.constructor).toBe(constructor); - if (constructor !== BigInt) - expect(Reflect.construct(constructor, []).constructor).toBe(constructor); + if (constructor !== BigInt) expect(Reflect.construct(constructor, []).constructor).toBe(constructor); }); let o = {}; diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getOwnPropertyDescriptor.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getOwnPropertyDescriptor.js index 60fb2303a8..b74d28165e 100644 --- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getOwnPropertyDescriptor.js +++ b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-getOwnPropertyDescriptor.js @@ -1,13 +1,8 @@ describe("[Call][GetOwnProperty]] trap normal behavior", () => { test("forwarding when not defined in handler", () => { + expect(Object.getOwnPropertyDescriptor(new Proxy({}, { getOwnPropertyDescriptor: null }), "a")).toBeUndefined(); expect( - Object.getOwnPropertyDescriptor(new Proxy({}, { getOwnPropertyDescriptor: null }), "a") - ).toBeUndefined(); - expect( - Object.getOwnPropertyDescriptor( - new Proxy({}, { getOwnPropertyDescriptor: undefined }), - "a" - ) + Object.getOwnPropertyDescriptor(new Proxy({}, { getOwnPropertyDescriptor: undefined }), "a") ).toBeUndefined(); expect(Object.getOwnPropertyDescriptor(new Proxy({}, {}), "a")).toBeUndefined(); }); diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js index 0582db348e..ecf52beda2 100644 --- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js +++ b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js @@ -7,33 +7,21 @@ test("constructs properly", () => { test("constructor argument count", () => { expect(() => { new Proxy(); - }).toThrowWithMessage( - TypeError, - "Expected target argument of Proxy constructor to be object, got undefined" - ); + }).toThrowWithMessage(TypeError, "Expected target argument of Proxy constructor to be object, got undefined"); expect(() => { new Proxy({}); - }).toThrowWithMessage( - TypeError, - "Expected handler argument of Proxy constructor to be object, got undefined" - ); + }).toThrowWithMessage(TypeError, "Expected handler argument of Proxy constructor to be object, got undefined"); }); test("constructor requires objects", () => { expect(() => { new Proxy(1, {}); - }).toThrowWithMessage( - TypeError, - "Expected target argument of Proxy constructor to be object, got 1" - ); + }).toThrowWithMessage(TypeError, "Expected target argument of Proxy constructor to be object, got 1"); expect(() => { new Proxy({}, 1); - }).toThrowWithMessage( - TypeError, - "Expected handler argument of Proxy constructor to be object, got 1" - ); + }).toThrowWithMessage(TypeError, "Expected handler argument of Proxy constructor to be object, got 1"); }); test("constructor must be invoked with 'new'", () => { diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.revocable.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.revocable.js index 1b8228ef19..e800e0210c 100644 --- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.revocable.js +++ b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.revocable.js @@ -6,33 +6,21 @@ describe("errors", () => { test("constructor argument count", () => { expect(() => { Proxy.revocable(); - }).toThrowWithMessage( - TypeError, - "Expected target argument of Proxy constructor to be object, got undefined" - ); + }).toThrowWithMessage(TypeError, "Expected target argument of Proxy constructor to be object, got undefined"); expect(() => { Proxy.revocable({}); - }).toThrowWithMessage( - TypeError, - "Expected handler argument of Proxy constructor to be object, got undefined" - ); + }).toThrowWithMessage(TypeError, "Expected handler argument of Proxy constructor to be object, got undefined"); }); test("constructor requires objects", () => { expect(() => { Proxy.revocable(1, {}); - }).toThrowWithMessage( - TypeError, - "Expected target argument of Proxy constructor to be object, got 1" - ); + }).toThrowWithMessage(TypeError, "Expected target argument of Proxy constructor to be object, got 1"); expect(() => { Proxy.revocable({}, 1); - }).toThrowWithMessage( - TypeError, - "Expected handler argument of Proxy constructor to be object, got 1" - ); + }).toThrowWithMessage(TypeError, "Expected handler argument of Proxy constructor to be object, got 1"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.apply.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.apply.js index d8787b9b6a..c890733c0a 100644 --- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.apply.js +++ b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.apply.js @@ -23,9 +23,7 @@ describe("errors", () => { describe("normal behavior", () => { test("calling built-in functions", () => { expect(Reflect.apply(String.prototype.charAt, "foo", [0])).toBe("f"); - expect(Reflect.apply(Array.prototype.indexOf, ["hello", 123, "foo", "bar"], ["foo"])).toBe( - 2 - ); + expect(Reflect.apply(Array.prototype.indexOf, ["hello", 123, "foo", "bar"], ["foo"])).toBe(2); }); test("|this| argument is forwarded to called function", () => { diff --git a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.defineProperty.js b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.defineProperty.js index c81da19678..0a88b314e6 100644 --- a/Libraries/LibJS/Tests/builtins/Reflect/Reflect.defineProperty.js +++ b/Libraries/LibJS/Tests/builtins/Reflect/Reflect.defineProperty.js @@ -45,9 +45,7 @@ describe("normal behavior", () => { var o = {}; expect(o.foo).toBeUndefined(); - expect( - Reflect.defineProperty(o, "foo", { value: 1, configurable: true, writable: true }) - ).toBeTrue(); + expect(Reflect.defineProperty(o, "foo", { value: 1, configurable: true, writable: true })).toBeTrue(); expect(o.foo).toBe(1); expect(Reflect.defineProperty(o, "foo", { value: 2 })).toBeTrue(); expect(o.foo).toBe(2); @@ -57,9 +55,7 @@ describe("normal behavior", () => { var o = {}; expect(o.foo).toBeUndefined(); - expect( - Reflect.defineProperty(o, "foo", { value: 1, configurable: true, writable: false }) - ).toBeTrue(); + expect(Reflect.defineProperty(o, "foo", { value: 1, configurable: true, writable: false })).toBeTrue(); expect(o.foo).toBe(1); expect(Reflect.defineProperty(o, "foo", { value: 2 })).toBeTrue(); expect(o.foo).toBe(2); @@ -69,9 +65,7 @@ describe("normal behavior", () => { var o = {}; expect(o.foo).toBeUndefined(); - expect( - Reflect.defineProperty(o, "foo", { value: 1, configurable: false, writable: false }) - ).toBeTrue(); + expect(Reflect.defineProperty(o, "foo", { value: 1, configurable: false, writable: false })).toBeTrue(); expect(o.foo).toBe(1); expect(Reflect.defineProperty(o, "foo", { value: 2 })).toBeFalse(); expect(o.foo).toBe(1); diff --git a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.js b/Libraries/LibJS/Tests/builtins/RegExp/RegExp.js index 5253ee3ee0..1184a6daac 100644 --- a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.js +++ b/Libraries/LibJS/Tests/builtins/RegExp/RegExp.js @@ -2,10 +2,7 @@ describe("errors", () => { test("invalid pattern", () => { expect(() => { RegExp("["); - }).toThrowWithMessage( - SyntaxError, - "RegExp compile error: Error during parsing of regular expression:" - ); + }).toThrowWithMessage(SyntaxError, "RegExp compile error: Error during parsing of regular expression:"); }); test("invalid flag", () => { @@ -116,26 +113,7 @@ test("Unicode properties of strings", () => { }).not.toThrow(); } - const matchStrings = [ - "0", - "1", - "2", - "3", - "4", - "5", - "8", - "A", - "B", - "D", - "E", - "F", - "a", - "b", - "c", - "d", - "e", - "f", - ]; + const matchStrings = ["0", "1", "2", "3", "4", "5", "8", "A", "B", "D", "E", "F", "a", "b", "c", "d", "e", "f"]; const nonMatchStrings = [ "6\uFE0F\u20E3", diff --git a/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.evaluate.js b/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.evaluate.js index 1d453b07a5..2f662a488a 100644 --- a/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.evaluate.js +++ b/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.evaluate.js @@ -50,14 +50,10 @@ describe("normal behavior", () => { expect(shadowRealm.evaluate("(function () {})")).toHaveLength(0); expect(shadowRealm.evaluate("(function (foo, bar) {})")).toHaveLength(2); expect( - shadowRealm.evaluate( - "Object.defineProperty(function () {}, 'length', { get() { return -Infinity } })" - ) + shadowRealm.evaluate("Object.defineProperty(function () {}, 'length', { get() { return -Infinity } })") ).toHaveLength(0); expect( - shadowRealm.evaluate( - "Object.defineProperty(function () {}, 'length', { get() { return Infinity } })" - ) + shadowRealm.evaluate("Object.defineProperty(function () {}, 'length', { get() { return Infinity } })") ).toHaveLength(Infinity); for (const property of ["name", "length"]) { @@ -70,18 +66,12 @@ describe("normal behavior", () => { }); ` ); - }).toThrowWithMessage( - TypeError, - "Trying to copy target name and length did not complete normally" - ); + }).toThrowWithMessage(TypeError, "Trying to copy target name and length did not complete normally"); } expect(() => { shadowRealm.evaluate("(function () { throw Error(); })")(); - }).toThrowWithMessage( - TypeError, - "Call of wrapped target function did not complete normally" - ); + }).toThrowWithMessage(TypeError, "Call of wrapped target function did not complete normally"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/String/String.fromCodePoint.js b/Libraries/LibJS/Tests/builtins/String/String.fromCodePoint.js index 220655d8be..0fdae660f0 100644 --- a/Libraries/LibJS/Tests/builtins/String/String.fromCodePoint.js +++ b/Libraries/LibJS/Tests/builtins/String/String.fromCodePoint.js @@ -16,22 +16,13 @@ test("basic functionality", () => { test("errors", () => { expect(() => { String.fromCodePoint(NaN); - }).toThrowWithMessage( - RangeError, - "must be an integer no less than 0 and no greater than 0x10FFFF" - ); + }).toThrowWithMessage(RangeError, "must be an integer no less than 0 and no greater than 0x10FFFF"); expect(() => { String.fromCodePoint(-5); - }).toThrowWithMessage( - RangeError, - "must be an integer no less than 0 and no greater than 0x10FFFF" - ); + }).toThrowWithMessage(RangeError, "must be an integer no less than 0 and no greater than 0x10FFFF"); expect(() => { String.fromCodePoint(0x123ffff); - }).toThrowWithMessage( - RangeError, - "must be an integer no less than 0 and no greater than 0x10FFFF" - ); + }).toThrowWithMessage(RangeError, "must be an integer no less than 0 and no greater than 0x10FFFF"); }); diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.split.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.split.js index 136ec62401..643d4686f7 100644 --- a/Libraries/LibJS/Tests/builtins/String/String.prototype.split.js +++ b/Libraries/LibJS/Tests/builtins/String/String.prototype.split.js @@ -2,21 +2,7 @@ test("basic functionality", () => { expect(String.prototype.split).toHaveLength(2); expect("hello friends".split()).toEqual(["hello friends"]); - expect("hello friends".split("")).toEqual([ - "h", - "e", - "l", - "l", - "o", - " ", - "f", - "r", - "i", - "e", - "n", - "d", - "s", - ]); + expect("hello friends".split("")).toEqual(["h", "e", "l", "l", "o", " ", "f", "r", "i", "e", "n", "d", "s"]); expect("hello friends".split(" ")).toEqual(["hello", "friends"]); expect("a,b,c,d".split(",")).toEqual(["a", "b", "c", "d"]); diff --git a/Libraries/LibJS/Tests/builtins/SuppressedError/SuppressedError.js b/Libraries/LibJS/Tests/builtins/SuppressedError/SuppressedError.js index ade5c1f26b..e705c02a50 100644 --- a/Libraries/LibJS/Tests/builtins/SuppressedError/SuppressedError.js +++ b/Libraries/LibJS/Tests/builtins/SuppressedError/SuppressedError.js @@ -26,9 +26,7 @@ describe("normal behavior", () => { expect(new SuppressedError().toString()).toBe("SuppressedError"); expect(new SuppressedError(1).toString()).toBe("SuppressedError"); expect(new SuppressedError(1, 1).toString()).toBe("SuppressedError"); - expect(new SuppressedError(undefined, undefined, "Foo").toString()).toBe( - "SuppressedError: Foo" - ); + expect(new SuppressedError(undefined, undefined, "Foo").toString()).toBe("SuppressedError: Foo"); expect(new SuppressedError(1, 1, "Foo").toString()).toBe("SuppressedError: Foo"); expect(Object.hasOwn(new SuppressedError(), "error")).toBeTrue(); expect(Object.hasOwn(new SuppressedError(), "suppressed")).toBeTrue(); @@ -39,10 +37,7 @@ describe("normal behavior", () => { test("converts message to string", () => { expect(new SuppressedError(undefined, undefined, 1)).toHaveProperty("message", "1"); - expect(new SuppressedError(undefined, undefined, {})).toHaveProperty( - "message", - "[object Object]" - ); + expect(new SuppressedError(undefined, undefined, {})).toHaveProperty("message", "[object Object]"); }); test("supports options object with cause", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.compare.js b/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.compare.js index a8bd094aed..4d9b08a9a8 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.compare.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.compare.js @@ -121,30 +121,21 @@ describe("errors", () => { expect(() => { Temporal.Duration.compare(duration1, duration2); - }).toThrowWithMessage( - RangeError, - "A starting point is required for comparing calendar units" - ); + }).toThrowWithMessage(RangeError, "A starting point is required for comparing calendar units"); const duration3 = new Temporal.Duration(0, 3); const duration4 = new Temporal.Duration(0, 4); expect(() => { Temporal.Duration.compare(duration3, duration4); - }).toThrowWithMessage( - RangeError, - "A starting point is required for comparing calendar units" - ); + }).toThrowWithMessage(RangeError, "A starting point is required for comparing calendar units"); const duration5 = new Temporal.Duration(0, 0, 5); const duration6 = new Temporal.Duration(0, 0, 6); expect(() => { Temporal.Duration.compare(duration5, duration6); - }).toThrowWithMessage( - RangeError, - "A starting point is required for comparing calendar units" - ); + }).toThrowWithMessage(RangeError, "A starting point is required for comparing calendar units"); // Still throws if year/month/week of one the duration objects is non-zero. const duration7 = new Temporal.Duration(0, 0, 0, 7); @@ -152,20 +143,14 @@ describe("errors", () => { expect(() => { Temporal.Duration.compare(duration7, duration8); - }).toThrowWithMessage( - RangeError, - "A starting point is required for comparing calendar units" - ); + }).toThrowWithMessage(RangeError, "A starting point is required for comparing calendar units"); const duration9 = new Temporal.Duration(0, 0, 9); const duration10 = new Temporal.Duration(0, 0, 0, 10); expect(() => { Temporal.Duration.compare(duration9, duration10); - }).toThrowWithMessage( - RangeError, - "A starting point is required for comparing calendar units" - ); + }).toThrowWithMessage(RangeError, "A starting point is required for comparing calendar units"); }); test("sub-minute time zone offset mismatch (unambiguous time zone transition)", () => { @@ -176,19 +161,13 @@ describe("errors", () => { Temporal.Duration.compare(duration1, duration2, { relativeTo: "1970-01-01T00:00:00-00:44:40[Africa/Monrovia]", }); - }).toThrowWithMessage( - RangeError, - "Invalid offset for the provided date and time in the current time zone" - ); + }).toThrowWithMessage(RangeError, "Invalid offset for the provided date and time in the current time zone"); expect(() => { Temporal.Duration.compare(duration1, duration2, { relativeTo: "1970-01-01T00:00:00-00:45:00[Africa/Monrovia]", }); - }).toThrowWithMessage( - RangeError, - "Invalid offset for the provided date and time in the current time zone" - ); + }).toThrowWithMessage(RangeError, "Invalid offset for the provided date and time in the current time zone"); }); test("sub-minute time zone offset mismatch (ambiguous time zone transition)", () => { @@ -199,9 +178,6 @@ describe("errors", () => { Temporal.Duration.compare(duration1, duration2, { relativeTo: "1952-10-15T23:59:59-11:19:50[Pacific/Niue]", }); - }).toThrowWithMessage( - RangeError, - "Invalid offset for the provided date and time in the current time zone" - ); + }).toThrowWithMessage(RangeError, "Invalid offset for the provided date and time in the current time zone"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.from.js b/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.from.js index bd2e09be7e..cef3bddb84 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.from.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.from.js @@ -17,9 +17,7 @@ describe("correct behavior", () => { }); test("Duration instance argument", () => { - const duration = Temporal.Duration.from( - new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - ); + const duration = Temporal.Duration.from(new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); expectDurationOneToTen(duration); }); @@ -62,17 +60,11 @@ describe("errors", () => { expect(() => { Temporal.Duration.from({ years: "foo" }); - }).toThrowWithMessage( - RangeError, - "Invalid value for duration property 'years': must be an integer, got foo" - ); + }).toThrowWithMessage(RangeError, "Invalid value for duration property 'years': must be an integer, got foo"); expect(() => { Temporal.Duration.from({ years: NaN }); - }).toThrowWithMessage( - RangeError, - "Invalid value for duration property 'years': must be an integer, got NaN" - ); + }).toThrowWithMessage(RangeError, "Invalid value for duration property 'years': must be an integer, got NaN"); }); test("invalid duration string", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.round.js b/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.round.js index bc3be2947b..d83227a6b8 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.round.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.round.js @@ -38,10 +38,7 @@ describe("correct behavior", () => { ["nanosecond", { nanoseconds: 1840300200300400 }], ["microsecond", { microseconds: 1840300200300, nanoseconds: 400 }], ["millisecond", { milliseconds: 1840300200, microseconds: 300, nanoseconds: 400 }], - [ - "second", - { seconds: 1840300, milliseconds: 200, microseconds: 300, nanoseconds: 400 }, - ], + ["second", { seconds: 1840300, milliseconds: 200, microseconds: 300, nanoseconds: 400 }], [ "minute", { @@ -143,20 +140,14 @@ describe("errors", () => { const duration = new Temporal.Duration(1); expect(() => { duration.round({ smallestUnit: "second", roundingMode: "serenityOS" }); - }).toThrowWithMessage( - RangeError, - "serenityOS is not a valid value for option roundingMode" - ); + }).toThrowWithMessage(RangeError, "serenityOS is not a valid value for option roundingMode"); }); test("invalid smallest unit", () => { const duration = new Temporal.Duration(1); expect(() => { duration.round({ smallestUnit: "serenityOS" }); - }).toThrowWithMessage( - RangeError, - "serenityOS is not a valid value for option smallestUnit" - ); + }).toThrowWithMessage(RangeError, "serenityOS is not a valid value for option smallestUnit"); }); test("increment may not be NaN", () => { @@ -176,10 +167,7 @@ describe("errors", () => { }).toThrowWithMessage(RangeError, "0 is not a valid value for option roundingIncrement"); expect(() => { duration.round({ smallestUnit: "second", roundingIncrement: Infinity }); - }).toThrowWithMessage( - RangeError, - "Infinity is not a valid value for option roundingIncrement" - ); + }).toThrowWithMessage(RangeError, "Infinity is not a valid value for option roundingIncrement"); }); test("must provide one or both of smallestUnit or largestUnit", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.toJSON.js b/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.toJSON.js index d324e957d2..a2db44e82e 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.toJSON.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.toJSON.js @@ -4,9 +4,7 @@ describe("correct behavior", () => { }); test("basic functionality", () => { - expect(new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).toJSON()).toBe( - "P1Y2M3W4DT5H6M7.00800901S" - ); + expect(new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).toJSON()).toBe("P1Y2M3W4DT5H6M7.00800901S"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.toString.js index 1e9ea6a284..4b3ba7e8c0 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.toString.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Duration/Duration.prototype.toString.js @@ -25,10 +25,7 @@ describe("correct behavior", () => { [[1, 2, 3, 4, 5, 6, 7, 8], "P1Y2M3W4DT5H6M7.008S"], [[1, 2, 3, 4, 5, 6, 7, 8, 9], "P1Y2M3W4DT5H6M7.008009S"], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], "P1Y2M3W4DT5H6M7.00800901S"], - [ - [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], - "P100Y200M300W400DT500H600M700.800901S", - ], + [[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], "P100Y200M300W400DT500H600M700.800901S"], [[-1], "-P1Y"], ]; for (const [args, expected] of values) { @@ -44,9 +41,7 @@ describe("correct behavior", () => { ["nanosecond", "P1Y2M3W4DT5H6M7.008010000S"], ]; for (const [smallestUnit, expected] of values) { - expect( - new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 8, 10).toString({ smallestUnit }) - ).toBe(expected); + expect(new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 8, 10).toString({ smallestUnit })).toBe(expected); } }); @@ -85,10 +80,7 @@ describe("errors", () => { for (const smallestUnit of values) { expect(() => { new Temporal.Duration(0).toString({ smallestUnit }); - }).toThrowWithMessage( - RangeError, - `${smallestUnit} is not a valid value for option smallestUnit` - ); + }).toThrowWithMessage(RangeError, `${smallestUnit} is not a valid value for option smallestUnit`); } }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.from.js b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.from.js index a7ec6f51ce..6474107e41 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.from.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.from.js @@ -9,14 +9,11 @@ describe("correct behavior", () => { }); test("Instant string argument", () => { - expect(Temporal.Instant.from("1975-02-02T14:25:36.123456789Z").epochNanoseconds).toBe( + expect(Temporal.Instant.from("1975-02-02T14:25:36.123456789Z").epochNanoseconds).toBe(160583136123456789n); + // Time zone is not validated + expect(Temporal.Instant.from("1975-02-02T14:25:36.123456789Z[Custom/TimeZone]").epochNanoseconds).toBe( 160583136123456789n ); - // Time zone is not validated - expect( - Temporal.Instant.from("1975-02-02T14:25:36.123456789Z[Custom/TimeZone]") - .epochNanoseconds - ).toBe(160583136123456789n); // Accepts but ignores the calendar. let result = null; diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.fromEpochMilliseconds.js b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.fromEpochMilliseconds.js index df7f5258c6..b661fd7e14 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.fromEpochMilliseconds.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.fromEpochMilliseconds.js @@ -6,21 +6,17 @@ describe("correct behavior", () => { test("basic functionality", () => { expect(Temporal.Instant.fromEpochMilliseconds(0).epochMilliseconds).toBe(0); expect(Temporal.Instant.fromEpochMilliseconds(1).epochMilliseconds).toBe(1); - expect(Temporal.Instant.fromEpochMilliseconds(999_999_999).epochMilliseconds).toBe( - 999_999_999 + expect(Temporal.Instant.fromEpochMilliseconds(999_999_999).epochMilliseconds).toBe(999_999_999); + expect(Temporal.Instant.fromEpochMilliseconds(8_640_000_000_000_000).epochMilliseconds).toBe( + 8_640_000_000_000_000 ); - expect( - Temporal.Instant.fromEpochMilliseconds(8_640_000_000_000_000).epochMilliseconds - ).toBe(8_640_000_000_000_000); expect(Temporal.Instant.fromEpochMilliseconds(-0).epochMilliseconds).toBe(0); expect(Temporal.Instant.fromEpochMilliseconds(-1).epochMilliseconds).toBe(-1); - expect(Temporal.Instant.fromEpochMilliseconds(-999_999_999).epochMilliseconds).toBe( - -999_999_999 + expect(Temporal.Instant.fromEpochMilliseconds(-999_999_999).epochMilliseconds).toBe(-999_999_999); + expect(Temporal.Instant.fromEpochMilliseconds(-8_640_000_000_000_000).epochMilliseconds).toBe( + -8_640_000_000_000_000 ); - expect( - Temporal.Instant.fromEpochMilliseconds(-8_640_000_000_000_000).epochMilliseconds - ).toBe(-8_640_000_000_000_000); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.fromEpochNanoseconds.js b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.fromEpochNanoseconds.js index 08a0c91aba..d32827830a 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.fromEpochNanoseconds.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.fromEpochNanoseconds.js @@ -6,21 +6,17 @@ describe("correct behavior", () => { test("basic functionality", () => { expect(Temporal.Instant.fromEpochNanoseconds(0n).epochNanoseconds).toBe(0n); expect(Temporal.Instant.fromEpochNanoseconds(1n).epochNanoseconds).toBe(1n); - expect(Temporal.Instant.fromEpochNanoseconds(999_999_999n).epochNanoseconds).toBe( - 999_999_999n + expect(Temporal.Instant.fromEpochNanoseconds(999_999_999n).epochNanoseconds).toBe(999_999_999n); + expect(Temporal.Instant.fromEpochNanoseconds(8_640_000_000_000_000_000_000n).epochNanoseconds).toBe( + 8_640_000_000_000_000_000_000n ); - expect( - Temporal.Instant.fromEpochNanoseconds(8_640_000_000_000_000_000_000n).epochNanoseconds - ).toBe(8_640_000_000_000_000_000_000n); expect(Temporal.Instant.fromEpochNanoseconds(-0n).epochNanoseconds).toBe(0n); expect(Temporal.Instant.fromEpochNanoseconds(-1n).epochNanoseconds).toBe(-1n); - expect(Temporal.Instant.fromEpochNanoseconds(-999_999_999n).epochNanoseconds).toBe( - -999_999_999n + expect(Temporal.Instant.fromEpochNanoseconds(-999_999_999n).epochNanoseconds).toBe(-999_999_999n); + expect(Temporal.Instant.fromEpochNanoseconds(-8_640_000_000_000_000_000_000n).epochNanoseconds).toBe( + -8_640_000_000_000_000_000_000n ); - expect( - Temporal.Instant.fromEpochNanoseconds(-8_640_000_000_000_000_000_000n).epochNanoseconds - ).toBe(-8_640_000_000_000_000_000_000n); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.epochMilliseconds.js b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.epochMilliseconds.js index a45dd05e78..af3f1a764a 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.epochMilliseconds.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.epochMilliseconds.js @@ -7,9 +7,7 @@ describe("correct behavior", () => { expect(new Temporal.Instant(1_500_000n).epochMilliseconds).toBe(1); expect(new Temporal.Instant(1_999_999n).epochMilliseconds).toBe(1); expect(new Temporal.Instant(2_000_000n).epochMilliseconds).toBe(2); - expect(new Temporal.Instant(8_640_000_000_000_000_000_000n).epochMilliseconds).toBe( - 8_640_000_000_000_000 - ); + expect(new Temporal.Instant(8_640_000_000_000_000_000_000n).epochMilliseconds).toBe(8_640_000_000_000_000); expect(new Temporal.Instant(-0n).epochMilliseconds).toBe(0); expect(new Temporal.Instant(-1n).epochMilliseconds).toBe(-1); @@ -18,9 +16,7 @@ describe("correct behavior", () => { expect(new Temporal.Instant(-1_500_000n).epochMilliseconds).toBe(-2); expect(new Temporal.Instant(-1_999_999n).epochMilliseconds).toBe(-2); expect(new Temporal.Instant(-2_000_000n).epochMilliseconds).toBe(-2); - expect(new Temporal.Instant(-8_640_000_000_000_000_000_000n).epochMilliseconds).toBe( - -8_640_000_000_000_000 - ); + expect(new Temporal.Instant(-8_640_000_000_000_000_000_000n).epochMilliseconds).toBe(-8_640_000_000_000_000); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.round.js b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.round.js index 2643c96fb3..8cb0560129 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.round.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.round.js @@ -6,12 +6,9 @@ describe("correct behavior", () => { test("basic functionality", () => { const instant = new Temporal.Instant(1111111111111n); expect(instant.round({ smallestUnit: "second" }).epochNanoseconds).toBe(1111000000000n); + expect(instant.round({ smallestUnit: "second", roundingMode: "ceil" }).epochNanoseconds).toBe(1112000000000n); expect( - instant.round({ smallestUnit: "second", roundingMode: "ceil" }).epochNanoseconds - ).toBe(1112000000000n); - expect( - instant.round({ smallestUnit: "minute", roundingIncrement: 30, roundingMode: "floor" }) - .epochNanoseconds + instant.round({ smallestUnit: "minute", roundingIncrement: 30, roundingMode: "floor" }).epochNanoseconds ).toBe(0n); expect( instant.round({ @@ -53,9 +50,7 @@ describe("correct behavior", () => { test("string argument is implicitly converted to options object", () => { const instant = new Temporal.Instant(1111111111111n); - expect( - instant.round("second").equals(instant.round({ smallestUnit: "second" })) - ).toBeTrue(); + expect(instant.round("second").equals(instant.round({ smallestUnit: "second" }))).toBeTrue(); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.since.js b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.since.js index 6c1205712c..63c5bc1e1a 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.since.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.since.js @@ -20,12 +20,8 @@ describe("errors", () => { }); describe("rounding modes", () => { - const earlier = new Temporal.Instant( - 217178610_123_456_789n /* 1976-11-18T15:23:30.123456789Z */ - ); - const later = new Temporal.Instant( - 1572345998_271_986_289n /* 2019-10-29T10:46:38.271986289Z */ - ); + const earlier = new Temporal.Instant(217178610_123_456_789n /* 1976-11-18T15:23:30.123456789Z */); + const later = new Temporal.Instant(1572345998_271_986_289n /* 2019-10-29T10:46:38.271986289Z */); const largestUnit = "hours"; test("'ceil' rounding mode", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.toString.js index 283211da69..8997d34227 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.toString.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.toString.js @@ -35,9 +35,7 @@ describe("correct behavior", () => { } // Ignored when smallestUnit is given - expect(instant.toString({ smallestUnit: "minute", fractionalSecondDigits: 9 })).toBe( - "2021-07-06T23:42Z" - ); + expect(instant.toString({ smallestUnit: "minute", fractionalSecondDigits: 9 })).toBe("2021-07-06T23:42Z"); }); test("smallestUnit option", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.until.js b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.until.js index 6c7b824fcd..8a8ee18c45 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.until.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/Instant/Instant.prototype.until.js @@ -20,12 +20,8 @@ describe("errors", () => { }); describe("rounding modes", () => { - const earlier = new Temporal.Instant( - 217178610_123_456_789n /* 1976-11-18T15:23:30.123456789Z */ - ); - const later = new Temporal.Instant( - 1572345998_271_986_289n /* 2019-10-29T10:46:38.271986289Z */ - ); + const earlier = new Temporal.Instant(217178610_123_456_789n /* 1976-11-18T15:23:30.123456789Z */); + const later = new Temporal.Instant(1572345998_271_986_289n /* 2019-10-29T10:46:38.271986289Z */); const largestUnit = "hours"; test("'ceil' rounding mode", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.js index 8273a1bdba..32f481842c 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.js @@ -2,10 +2,7 @@ describe("errors", () => { test("called without new", () => { expect(() => { Temporal.PlainDate(); - }).toThrowWithMessage( - TypeError, - "Temporal.PlainDate constructor must be called with 'new'" - ); + }).toThrowWithMessage(TypeError, "Temporal.PlainDate constructor must be called with 'new'"); }); test("cannot pass Infinity", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.since.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.since.js index 16326486a5..14cec9843d 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.since.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.since.js @@ -134,14 +134,7 @@ describe("errors", () => { const dateOne = new Temporal.PlainDate(2021, 11, 14); const dateTwo = new Temporal.PlainDate(2022, 12, 25); - const disallowedUnits = [ - "hour", - "minute", - "second", - "millisecond", - "microsecond", - "nanosecond", - ]; + const disallowedUnits = ["hour", "minute", "second", "millisecond", "microsecond", "nanosecond"]; for (const smallestUnit of disallowedUnits) { const singularSmallestUnitOptions = { smallestUnit }; @@ -149,17 +142,11 @@ describe("errors", () => { expect(() => { dateOne.since(dateTwo, singularSmallestUnitOptions); - }).toThrowWithMessage( - RangeError, - `${smallestUnit} is not a valid value for option smallestUnit` - ); + }).toThrowWithMessage(RangeError, `${smallestUnit} is not a valid value for option smallestUnit`); expect(() => { dateOne.since(dateTwo, pluralSmallestUnitOptions); - }).toThrowWithMessage( - RangeError, - `${smallestUnit} is not a valid value for option smallestUnit` - ); + }).toThrowWithMessage(RangeError, `${smallestUnit} is not a valid value for option smallestUnit`); } for (const largestUnit of disallowedUnits) { @@ -168,17 +155,11 @@ describe("errors", () => { expect(() => { dateOne.since(dateTwo, singularLargestUnitOptions); - }).toThrowWithMessage( - RangeError, - `${largestUnit} is not a valid value for option largestUnit` - ); + }).toThrowWithMessage(RangeError, `${largestUnit} is not a valid value for option largestUnit`); expect(() => { dateOne.since(dateTwo, pluralLargestUnitOptions); - }).toThrowWithMessage( - RangeError, - `${largestUnit} is not a valid value for option largestUnit` - ); + }).toThrowWithMessage(RangeError, `${largestUnit} is not a valid value for option largestUnit`); } }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.until.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.until.js index 582c0166e7..bdbc1cd5ec 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.until.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.until.js @@ -134,14 +134,7 @@ describe("errors", () => { const dateOne = new Temporal.PlainDate(2021, 11, 14); const dateTwo = new Temporal.PlainDate(2022, 12, 25); - const disallowedUnits = [ - "hour", - "minute", - "second", - "millisecond", - "microsecond", - "nanosecond", - ]; + const disallowedUnits = ["hour", "minute", "second", "millisecond", "microsecond", "nanosecond"]; for (const smallestUnit of disallowedUnits) { const singularSmallestUnitOptions = { smallestUnit }; @@ -149,17 +142,11 @@ describe("errors", () => { expect(() => { dateOne.until(dateTwo, singularSmallestUnitOptions); - }).toThrowWithMessage( - RangeError, - `${smallestUnit} is not a valid value for option smallestUnit` - ); + }).toThrowWithMessage(RangeError, `${smallestUnit} is not a valid value for option smallestUnit`); expect(() => { dateOne.until(dateTwo, pluralSmallestUnitOptions); - }).toThrowWithMessage( - RangeError, - `${smallestUnit} is not a valid value for option smallestUnit` - ); + }).toThrowWithMessage(RangeError, `${smallestUnit} is not a valid value for option smallestUnit`); } for (const largestUnit of disallowedUnits) { @@ -168,17 +155,11 @@ describe("errors", () => { expect(() => { dateOne.until(dateTwo, singularLargestUnitOptions); - }).toThrowWithMessage( - RangeError, - `${largestUnit} is not a valid value for option largestUnit` - ); + }).toThrowWithMessage(RangeError, `${largestUnit} is not a valid value for option largestUnit`); expect(() => { dateOne.until(dateTwo, pluralLargestUnitOptions); - }).toThrowWithMessage( - RangeError, - `${largestUnit} is not a valid value for option largestUnit` - ); + }).toThrowWithMessage(RangeError, `${largestUnit} is not a valid value for option largestUnit`); } }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.from.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.from.js index 8712a6bc26..966b09e1fc 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.from.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.from.js @@ -129,10 +129,7 @@ describe("errors", () => { [{ year: 0, month: 1, day: 1, hour: 24 }, "Invalid plain time"], [{ year: 0, month: 1, day: 1, hour: 0, minute: 60 }, "Invalid plain time"], [{ year: 0, month: 1, day: 1, hour: 0, minute: 0, second: 60 }, "Invalid plain time"], - [ - { year: 0, month: 1, day: 1, hour: 0, minute: 0, second: 0, millisecond: 1000 }, - "Invalid plain time", - ], + [{ year: 0, month: 1, day: 1, hour: 0, minute: 0, second: 0, millisecond: 1000 }, "Invalid plain time"], [ { year: 0, diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.js index 9c20964d44..643ee32ec4 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.js @@ -2,10 +2,7 @@ describe("errors", () => { test("called without new", () => { expect(() => { Temporal.PlainDateTime(); - }).toThrowWithMessage( - TypeError, - "Temporal.PlainDateTime constructor must be called with 'new'" - ); + }).toThrowWithMessage(TypeError, "Temporal.PlainDateTime constructor must be called with 'new'"); }); test("cannot pass Infinity", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.round.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.round.js index 6c58bfc164..24a0eef61a 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.round.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.round.js @@ -84,9 +84,7 @@ describe("correct behavior", () => { test("string argument is implicitly converted to options object", () => { const plainDateTime = new Temporal.PlainDateTime(2021, 11, 3, 18, 8, 10, 100, 200, 300); - expect( - plainDateTime.round("minute").equals(plainDateTime.round({ smallestUnit: "minute" })) - ).toBeTrue(); + expect(plainDateTime.round("minute").equals(plainDateTime.round({ smallestUnit: "minute" }))).toBeTrue(); }); test("range boundary conditions", () => { @@ -130,20 +128,14 @@ describe("errors", () => { expect(() => { const plainDateTime = new Temporal.PlainDateTime(2021, 11, 3, 18, 8, 10, 100, 200, 300); plainDateTime.round({ smallestUnit: "second", roundingMode: "serenityOS" }); - }).toThrowWithMessage( - RangeError, - "serenityOS is not a valid value for option roundingMode" - ); + }).toThrowWithMessage(RangeError, "serenityOS is not a valid value for option roundingMode"); }); test("invalid smallest unit", () => { expect(() => { const plainDateTime = new Temporal.PlainDateTime(2021, 11, 3, 18, 8, 10, 100, 200, 300); plainDateTime.round({ smallestUnit: "serenityOS" }); - }).toThrowWithMessage( - RangeError, - "serenityOS is not a valid value for option smallestUnit" - ); + }).toThrowWithMessage(RangeError, "serenityOS is not a valid value for option smallestUnit"); }); test("increment may not be NaN", () => { @@ -163,9 +155,6 @@ describe("errors", () => { }).toThrowWithMessage(RangeError, "0 is not a valid value for option roundingIncrement"); expect(() => { plainDateTime.round({ smallestUnit: "second", roundingIncrement: Infinity }); - }).toThrowWithMessage( - RangeError, - "Infinity is not a valid value for option roundingIncrement" - ); + }).toThrowWithMessage(RangeError, "Infinity is not a valid value for option roundingIncrement"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.since.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.since.js index 07af370a1d..0ff219c550 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.since.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.since.js @@ -9,16 +9,8 @@ describe("correct behavior", () => { [[2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9], "P394DT1H1M1.001001001S"], [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 1, 0, 0, 0, 0, 0, 0], "P399DT4H5M6.007008009S"], [[0, 1, 1, 0, 0, 0, 0, 0, 0], [1, 2, 3, 4, 5, 6, 7, 8, 9], "-P399DT4H5M6.007008009S"], - [ - [0, 12, 31, 23, 59, 59, 999, 999, 999], - [0, 1, 1, 0, 0, 0, 0, 0, 0], - "P365DT23H59M59.999999999S", - ], - [ - [0, 1, 1, 0, 0, 0, 0, 0, 0], - [0, 12, 31, 23, 59, 59, 999, 999, 999], - "-P365DT23H59M59.999999999S", - ], + [[0, 12, 31, 23, 59, 59, 999, 999, 999], [0, 1, 1, 0, 0, 0, 0, 0, 0], "P365DT23H59M59.999999999S"], + [[0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 12, 31, 23, 59, 59, 999, 999, 999], "-P365DT23H59M59.999999999S"], ]; for (const [args, argsOther, expected] of values) { const plainDateTime = new Temporal.PlainDateTime(...args); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.toLocaleString.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.toLocaleString.js index b48814a577..14a03ff0a8 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.toLocaleString.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.toLocaleString.js @@ -4,18 +4,7 @@ describe("correct behavior", () => { }); test("basic functionality", () => { - const plainDateTime = new Temporal.PlainDateTime( - 2021, - 11, - 3, - 1, - 33, - 5, - 100, - 200, - 300, - "gregory" - ); + const plainDateTime = new Temporal.PlainDateTime(2021, 11, 3, 1, 33, 5, 100, 200, 300, "gregory"); expect(plainDateTime.toLocaleString()).toBe("11/3/2021, 1:33:05 AM"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.toString.js index c43ff6d443..d5658d0efe 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.toString.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.toString.js @@ -30,9 +30,7 @@ describe("correct behavior", () => { } // Ignored when smallestUnit is given - expect(plainDateTime.toString({ smallestUnit: "minute", fractionalSecondDigits: 9 })).toBe( - "2021-11-03T01:33" - ); + expect(plainDateTime.toString({ smallestUnit: "minute", fractionalSecondDigits: 9 })).toBe("2021-11-03T01:33"); }); test("smallestUnit option", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.until.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.until.js index d1a9e6913f..bd6c58e5f3 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.until.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.until.js @@ -9,16 +9,8 @@ describe("correct behavior", () => { [[1, 2, 3, 4, 5, 6, 7, 8, 9], [2, 3, 4, 5, 6, 7, 8, 9, 10], "P394DT1H1M1.001001001S"], [[0, 1, 1, 0, 0, 0, 0, 0, 0], [1, 2, 3, 4, 5, 6, 7, 8, 9], "P399DT4H5M6.007008009S"], [[1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 1, 0, 0, 0, 0, 0, 0], "-P399DT4H5M6.007008009S"], - [ - [0, 1, 1, 0, 0, 0, 0, 0, 0], - [0, 12, 31, 23, 59, 59, 999, 999, 999], - "P365DT23H59M59.999999999S", - ], - [ - [0, 12, 31, 23, 59, 59, 999, 999, 999], - [0, 1, 1, 0, 0, 0, 0, 0, 0], - "-P365DT23H59M59.999999999S", - ], + [[0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 12, 31, 23, 59, 59, 999, 999, 999], "P365DT23H59M59.999999999S"], + [[0, 12, 31, 23, 59, 59, 999, 999, 999], [0, 1, 1, 0, 0, 0, 0, 0, 0], "-P365DT23H59M59.999999999S"], ]; for (const [args, argsOther, expected] of values) { const plainDateTime = new Temporal.PlainDateTime(...args); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.valueOf.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.valueOf.js index ec9daaee50..8f91ef2ef5 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.valueOf.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.valueOf.js @@ -2,9 +2,6 @@ describe("errors", () => { test("throws TypeError", () => { expect(() => { new Temporal.PlainDateTime(2021, 7, 22, 19, 54, 38).valueOf(); - }).toThrowWithMessage( - TypeError, - "Cannot convert Temporal.PlainDateTime to a primitive value" - ); + }).toThrowWithMessage(TypeError, "Cannot convert Temporal.PlainDateTime to a primitive value"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.with.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.with.js index 9d808bcbb2..3c0640aa03 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.with.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.prototype.with.js @@ -10,10 +10,7 @@ describe("correct behavior", () => { [{ year: 2021, month: 7 }, new Temporal.PlainDateTime(2021, 7, 1)], [{ year: 2021, month: 7, day: 6 }, new Temporal.PlainDateTime(2021, 7, 6)], [{ year: 2021, monthCode: "M07", day: 6 }, new Temporal.PlainDateTime(2021, 7, 6)], - [ - { hour: 18, minute: 14, second: 47 }, - new Temporal.PlainDateTime(1970, 1, 1, 18, 14, 47), - ], + [{ hour: 18, minute: 14, second: 47 }, new Temporal.PlainDateTime(1970, 1, 1, 18, 14, 47)], [ { year: 2021, diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.from.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.from.js index 2a52adad8b..46238cce83 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.from.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.from.js @@ -40,10 +40,7 @@ describe("correct behavior", () => { for (const value of values) { expect(() => { Temporal.PlainMonthDay.from(value); - }).not.toThrowWithMessage( - RangeError, - "MM-DD string format can only be used with the iso8601 calendar" - ); + }).not.toThrowWithMessage(RangeError, "MM-DD string format can only be used with the iso8601 calendar"); } }); }); @@ -95,9 +92,7 @@ describe("errors", () => { Temporal.PlainMonthDay.from("2023-02-10T22:56[u-ca=ladybird]"); } catch (e) { expect(e).toBeInstanceOf(RangeError); - expect(e.message).not.toBe( - "MM-DD string format can only be used with the iso8601 calendar" - ); + expect(e.message).not.toBe("MM-DD string format can only be used with the iso8601 calendar"); expect(e.message).toBe("Invalid calendar identifier 'ladybird'"); } }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.js index 78d0c4246d..58cb6a8918 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.js @@ -2,10 +2,7 @@ describe("errors", () => { test("called without new", () => { expect(() => { Temporal.PlainMonthDay(); - }).toThrowWithMessage( - TypeError, - "Temporal.PlainMonthDay constructor must be called with 'new'" - ); + }).toThrowWithMessage(TypeError, "Temporal.PlainMonthDay constructor must be called with 'new'"); }); test("cannot pass Infinity", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.toString.js index b296f8b071..6951fd65f7 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.toString.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.toString.js @@ -11,18 +11,14 @@ describe("correct behavior", () => { expect(plainMonthDay.toString({ calendarName: "auto" })).toBe("07-06"); expect(plainMonthDay.toString({ calendarName: "always" })).toBe("1972-07-06[u-ca=iso8601]"); expect(plainMonthDay.toString({ calendarName: "never" })).toBe("07-06"); - expect(plainMonthDay.toString({ calendarName: "critical" })).toBe( - "1972-07-06[!u-ca=iso8601]" - ); + expect(plainMonthDay.toString({ calendarName: "critical" })).toBe("1972-07-06[!u-ca=iso8601]"); plainMonthDay = new Temporal.PlainMonthDay(7, 6, "gregory", 2021); expect(plainMonthDay.toString()).toBe("2021-07-06[u-ca=gregory]"); expect(plainMonthDay.toString({ calendarName: "auto" })).toBe("2021-07-06[u-ca=gregory]"); expect(plainMonthDay.toString({ calendarName: "always" })).toBe("2021-07-06[u-ca=gregory]"); expect(plainMonthDay.toString({ calendarName: "never" })).toBe("2021-07-06"); - expect(plainMonthDay.toString({ calendarName: "critical" })).toBe( - "2021-07-06[!u-ca=gregory]" - ); + expect(plainMonthDay.toString({ calendarName: "critical" })).toBe("2021-07-06[!u-ca=gregory]"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.valueOf.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.valueOf.js index f8f48e07fc..ed8d3a13af 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.valueOf.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.valueOf.js @@ -3,9 +3,6 @@ describe("errors", () => { const plainMonthDay = new Temporal.PlainMonthDay(7, 6); expect(() => { plainMonthDay.valueOf(); - }).toThrowWithMessage( - TypeError, - "Cannot convert Temporal.PlainMonthDay to a primitive value" - ); + }).toThrowWithMessage(TypeError, "Cannot convert Temporal.PlainMonthDay to a primitive value"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.js index bc5ccf9922..fddc703226 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.js @@ -2,10 +2,7 @@ describe("errors", () => { test("called without new", () => { expect(() => { Temporal.PlainTime(); - }).toThrowWithMessage( - TypeError, - "Temporal.PlainTime constructor must be called with 'new'" - ); + }).toThrowWithMessage(TypeError, "Temporal.PlainTime constructor must be called with 'new'"); }); test("cannot pass Infinity", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.round.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.round.js index 6d9402699b..254226cd06 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.round.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.round.js @@ -64,9 +64,7 @@ describe("correct behavior", () => { test("string argument is implicitly converted to options object", () => { const plainTime = new Temporal.PlainTime(18, 15, 9, 100, 200, 300); - expect( - plainTime.round("minute").equals(plainTime.round({ smallestUnit: "minute" })) - ).toBeTrue(); + expect(plainTime.round("minute").equals(plainTime.round({ smallestUnit: "minute" }))).toBeTrue(); }); }); @@ -88,20 +86,14 @@ describe("errors", () => { expect(() => { const plainTime = new Temporal.PlainTime(18, 15, 9, 100, 200, 300); plainTime.round({ smallestUnit: "second", roundingMode: "serenityOS" }); - }).toThrowWithMessage( - RangeError, - "serenityOS is not a valid value for option roundingMode" - ); + }).toThrowWithMessage(RangeError, "serenityOS is not a valid value for option roundingMode"); }); test("invalid smallest unit", () => { expect(() => { const plainTime = new Temporal.PlainTime(18, 15, 9, 100, 200, 300); plainTime.round({ smallestUnit: "serenityOS" }); - }).toThrowWithMessage( - RangeError, - "serenityOS is not a valid value for option smallestUnit" - ); + }).toThrowWithMessage(RangeError, "serenityOS is not a valid value for option smallestUnit"); }); test("increment may not be NaN", () => { @@ -121,10 +113,7 @@ describe("errors", () => { }).toThrowWithMessage(RangeError, "0 is not a valid value for option roundingIncrement"); expect(() => { plainTime.round({ smallestUnit: "second", roundingIncrement: Infinity }); - }).toThrowWithMessage( - RangeError, - "Infinity is not a valid value for option roundingIncrement" - ); + }).toThrowWithMessage(RangeError, "Infinity is not a valid value for option roundingIncrement"); expect(() => { plainTime.round({ smallestUnit: "hours", roundingIncrement: 24 }); }).toThrowWithMessage(RangeError, "24 is not a valid value for option roundingIncrement"); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.since.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.since.js index 134ef2961d..b8c39e3ccd 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.since.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.since.js @@ -66,10 +66,7 @@ describe("errors", () => { const other = new Temporal.PlainTime(); expect(() => { plainTime.since(other, { smallestUnit }); - }).toThrowWithMessage( - RangeError, - `${smallestUnit} is not a valid value for option smallestUnit` - ); + }).toThrowWithMessage(RangeError, `${smallestUnit} is not a valid value for option smallestUnit`); } }); @@ -80,10 +77,7 @@ describe("errors", () => { const other = new Temporal.PlainTime(); expect(() => { plainTime.since(other, { largestUnit }); - }).toThrowWithMessage( - RangeError, - `${largestUnit} is not a valid value for option largestUnit` - ); + }).toThrowWithMessage(RangeError, `${largestUnit} is not a valid value for option largestUnit`); } }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.toString.js index 3f5ccd9fa8..144d76648f 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.toString.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.toString.js @@ -29,9 +29,7 @@ describe("correct behavior", () => { } // Ignored when smallestUnit is given - expect(plainTime.toString({ smallestUnit: "minute", fractionalSecondDigits: 9 })).toBe( - "18:14" - ); + expect(plainTime.toString({ smallestUnit: "minute", fractionalSecondDigits: 9 })).toBe("18:14"); }); test("smallestUnit option", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.until.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.until.js index 57923f7630..1e3a07eddf 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.until.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.until.js @@ -66,10 +66,7 @@ describe("errors", () => { const other = new Temporal.PlainTime(); expect(() => { plainTime.until(other, { smallestUnit }); - }).toThrowWithMessage( - RangeError, - `${smallestUnit} is not a valid value for option smallestUnit` - ); + }).toThrowWithMessage(RangeError, `${smallestUnit} is not a valid value for option smallestUnit`); } }); @@ -80,10 +77,7 @@ describe("errors", () => { const other = new Temporal.PlainTime(); expect(() => { plainTime.until(other, { largestUnit }); - }).toThrowWithMessage( - RangeError, - `${largestUnit} is not a valid value for option largestUnit` - ); + }).toThrowWithMessage(RangeError, `${largestUnit} is not a valid value for option largestUnit`); } }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.with.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.with.js index 67cfd5d7b2..7be181f472 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.with.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainTime/PlainTime.prototype.with.js @@ -1,17 +1,6 @@ -const PLAIN_TIME_PROPERTIES = [ - "hour", - "minute", - "second", - "millisecond", - "microsecond", - "nanosecond", -]; +const PLAIN_TIME_PROPERTIES = ["hour", "minute", "second", "millisecond", "microsecond", "nanosecond"]; -const REJECTED_CALENDAR_TYPES_THREE_ARGUMENTS = [ - Temporal.PlainDate, - Temporal.PlainDateTime, - Temporal.PlainTime, -]; +const REJECTED_CALENDAR_TYPES_THREE_ARGUMENTS = [Temporal.PlainDate, Temporal.PlainDateTime, Temporal.PlainTime]; const REJECTED_CALENDAR_TYPES_TWO_ARGUMENTS = [Temporal.PlainMonthDay, Temporal.PlainYearMonth]; @@ -116,16 +105,10 @@ describe("errors", () => { for (const property of PLAIN_TIME_PROPERTIES) { expect(() => { new Temporal.PlainTime().with({ [property]: Infinity }); - }).toThrowWithMessage( - RangeError, - `Invalid value Infinity for time field '${property}'` - ); + }).toThrowWithMessage(RangeError, `Invalid value Infinity for time field '${property}'`); expect(() => { new Temporal.PlainTime().with({ [property]: -Infinity }); - }).toThrowWithMessage( - RangeError, - `Invalid value -Infinity for time field '${property}'` - ); + }).toThrowWithMessage(RangeError, `Invalid value -Infinity for time field '${property}'`); } }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.from.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.from.js index 55fa5e358e..802f547d2e 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.from.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.from.js @@ -63,10 +63,7 @@ describe("correct behavior", () => { for (const value of values) { expect(() => { Temporal.PlainYearMonth.from(value); - }).not.toThrowWithMessage( - RangeError, - "YYYY-MM string format can only be used with the iso8601 calendar" - ); + }).not.toThrowWithMessage(RangeError, "YYYY-MM string format can only be used with the iso8601 calendar"); } }); }); @@ -121,9 +118,7 @@ describe("errors", () => { Temporal.PlainYearMonth.from("2023-02-10T22:57[u-ca=ladybird]"); } catch (e) { expect(e).toBeInstanceOf(RangeError); - expect(e.message).not.toBe( - "MM-DD string format can only be used with the iso8601 calendar" - ); + expect(e.message).not.toBe("MM-DD string format can only be used with the iso8601 calendar"); expect(e.message).toBe("Invalid calendar identifier 'ladybird'"); } }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.js index 8072eba2b3..bf19a9b891 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.js @@ -2,10 +2,7 @@ describe("errors", () => { test("called without new", () => { expect(() => { Temporal.PlainYearMonth(); - }).toThrowWithMessage( - TypeError, - "Temporal.PlainYearMonth constructor must be called with 'new'" - ); + }).toThrowWithMessage(TypeError, "Temporal.PlainYearMonth constructor must be called with 'new'"); }); test("cannot pass Infinity", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.since.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.since.js index 6cab7d59f2..a5f4b0070a 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.since.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.since.js @@ -52,48 +52,24 @@ describe("errors", () => { }); test("disallowed smallestUnit option values", () => { - const values = [ - "week", - "day", - "hour", - "minute", - "second", - "millisecond", - "microsecond", - "nanosecond", - ]; + const values = ["week", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond"]; for (const smallestUnit of values) { const plainYearMonth = new Temporal.PlainYearMonth(1970, 1); const other = new Temporal.PlainYearMonth(1970, 1); expect(() => { plainYearMonth.since(other, { smallestUnit }); - }).toThrowWithMessage( - RangeError, - `${smallestUnit} is not a valid value for option smallestUnit` - ); + }).toThrowWithMessage(RangeError, `${smallestUnit} is not a valid value for option smallestUnit`); } }); test("disallowed largestUnit option values", () => { - const values = [ - "week", - "day", - "hour", - "minute", - "second", - "millisecond", - "microsecond", - "nanosecond", - ]; + const values = ["week", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond"]; for (const largestUnit of values) { const plainYearMonth = new Temporal.PlainYearMonth(1970, 1); const other = new Temporal.PlainYearMonth(1970, 1); expect(() => { plainYearMonth.since(other, { largestUnit }); - }).toThrowWithMessage( - RangeError, - `${largestUnit} is not a valid value for option largestUnit` - ); + }).toThrowWithMessage(RangeError, `${largestUnit} is not a valid value for option largestUnit`); } }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.toString.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.toString.js index 99a667c699..70dae88b48 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.toString.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.toString.js @@ -9,24 +9,16 @@ describe("correct behavior", () => { plainYearMonth = new Temporal.PlainYearMonth(2021, 7); expect(plainYearMonth.toString()).toBe("2021-07"); expect(plainYearMonth.toString({ calendarName: "auto" })).toBe("2021-07"); - expect(plainYearMonth.toString({ calendarName: "always" })).toBe( - "2021-07-01[u-ca=iso8601]" - ); + expect(plainYearMonth.toString({ calendarName: "always" })).toBe("2021-07-01[u-ca=iso8601]"); expect(plainYearMonth.toString({ calendarName: "never" })).toBe("2021-07"); - expect(plainYearMonth.toString({ calendarName: "critical" })).toBe( - "2021-07-01[!u-ca=iso8601]" - ); + expect(plainYearMonth.toString({ calendarName: "critical" })).toBe("2021-07-01[!u-ca=iso8601]"); plainYearMonth = new Temporal.PlainYearMonth(2021, 7, "gregory", 6); expect(plainYearMonth.toString()).toBe("2021-07-06[u-ca=gregory]"); expect(plainYearMonth.toString({ calendarName: "auto" })).toBe("2021-07-06[u-ca=gregory]"); - expect(plainYearMonth.toString({ calendarName: "always" })).toBe( - "2021-07-06[u-ca=gregory]" - ); + expect(plainYearMonth.toString({ calendarName: "always" })).toBe("2021-07-06[u-ca=gregory]"); expect(plainYearMonth.toString({ calendarName: "never" })).toBe("2021-07-06"); - expect(plainYearMonth.toString({ calendarName: "critical" })).toBe( - "2021-07-06[!u-ca=gregory]" - ); + expect(plainYearMonth.toString({ calendarName: "critical" })).toBe("2021-07-06[!u-ca=gregory]"); plainYearMonth = new Temporal.PlainYearMonth(0, 1); expect(plainYearMonth.toString()).toBe("0000-01"); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.until.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.until.js index f05fa44c4e..7b1a75e0fb 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.until.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.until.js @@ -52,48 +52,24 @@ describe("errors", () => { }); test("disallowed smallestUnit option values", () => { - const values = [ - "week", - "day", - "hour", - "minute", - "second", - "millisecond", - "microsecond", - "nanosecond", - ]; + const values = ["week", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond"]; for (const smallestUnit of values) { const plainYearMonth = new Temporal.PlainYearMonth(1970, 1); const other = new Temporal.PlainYearMonth(1970, 1); expect(() => { plainYearMonth.until(other, { smallestUnit }); - }).toThrowWithMessage( - RangeError, - `${smallestUnit} is not a valid value for option smallestUnit` - ); + }).toThrowWithMessage(RangeError, `${smallestUnit} is not a valid value for option smallestUnit`); } }); test("disallowed largestUnit option values", () => { - const values = [ - "week", - "day", - "hour", - "minute", - "second", - "millisecond", - "microsecond", - "nanosecond", - ]; + const values = ["week", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond"]; for (const largestUnit of values) { const plainYearMonth = new Temporal.PlainYearMonth(1970, 1); const other = new Temporal.PlainYearMonth(1970, 1); expect(() => { plainYearMonth.until(other, { largestUnit }); - }).toThrowWithMessage( - RangeError, - `${largestUnit} is not a valid value for option largestUnit` - ); + }).toThrowWithMessage(RangeError, `${largestUnit} is not a valid value for option largestUnit`); } }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.valueOf.js b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.valueOf.js index 6c3d2d191f..f7d10fff41 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.valueOf.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.prototype.valueOf.js @@ -3,9 +3,6 @@ describe("errors", () => { const plainYearMonth = new Temporal.PlainYearMonth(2021, 7); expect(() => { plainYearMonth.valueOf(); - }).toThrowWithMessage( - TypeError, - "Cannot convert Temporal.PlainYearMonth to a primitive value" - ); + }).toThrowWithMessage(TypeError, "Cannot convert Temporal.PlainYearMonth to a primitive value"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.from.js b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.from.js index 2d76e0fc9f..6b8cd2a6fb 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.from.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.from.js @@ -34,18 +34,7 @@ describe("correct behavior", () => { test("PlainDateTime instance argument", () => { const timeZone = "UTC"; const calendar = "gregory"; - const plainDateTime = new Temporal.PlainDateTime( - 2021, - 11, - 7, - 0, - 20, - 5, - 100, - 200, - 300, - calendar - ); + const plainDateTime = new Temporal.PlainDateTime(2021, 11, 7, 0, 20, 5, 100, 200, 300, calendar); plainDateTime.timeZone = timeZone; const createdZoneDateTime = Temporal.ZonedDateTime.from(plainDateTime); @@ -96,9 +85,7 @@ describe("correct behavior", () => { }); test("from string", () => { - const zonedDateTime = Temporal.ZonedDateTime.from( - "2021-11-07T00:20:05.100200300+00:00[UTC][u-ca=iso8601]" - ); + const zonedDateTime = Temporal.ZonedDateTime.from("2021-11-07T00:20:05.100200300+00:00[UTC][u-ca=iso8601]"); expect(zonedDateTime).toBeInstanceOf(Temporal.ZonedDateTime); expect(zonedDateTime.timeZoneId).toBe("UTC"); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.js b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.js index 3997716f40..a6f942081a 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.js @@ -2,10 +2,7 @@ describe("errors", () => { test("called without new", () => { expect(() => { Temporal.ZonedDateTime(); - }).toThrowWithMessage( - TypeError, - "Temporal.ZonedDateTime constructor must be called with 'new'" - ); + }).toThrowWithMessage(TypeError, "Temporal.ZonedDateTime constructor must be called with 'new'"); }); test("out-of-range epoch nanoseconds value", () => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.round.js b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.round.js index 8680e1757a..6ef3b0037c 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.round.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.round.js @@ -5,12 +5,10 @@ describe("correct behavior", () => { test("basic functionality", () => { const zonedDateTime = new Temporal.ZonedDateTime(1111111111111n, "UTC"); - expect(zonedDateTime.round({ smallestUnit: "second" }).epochNanoseconds).toBe( - 1111000000000n + expect(zonedDateTime.round({ smallestUnit: "second" }).epochNanoseconds).toBe(1111000000000n); + expect(zonedDateTime.round({ smallestUnit: "second", roundingMode: "ceil" }).epochNanoseconds).toBe( + 1112000000000n ); - expect( - zonedDateTime.round({ smallestUnit: "second", roundingMode: "ceil" }).epochNanoseconds - ).toBe(1112000000000n); expect( zonedDateTime.round({ smallestUnit: "minute", @@ -29,9 +27,7 @@ describe("correct behavior", () => { test("string argument is implicitly converted to options object", () => { const zonedDateTime = new Temporal.ZonedDateTime(1111111111111n, "UTC"); - expect( - zonedDateTime.round("second").equals(zonedDateTime.round({ smallestUnit: "second" })) - ).toBeTrue(); + expect(zonedDateTime.round("second").equals(zonedDateTime.round({ smallestUnit: "second" }))).toBeTrue(); }); }); @@ -53,20 +49,14 @@ describe("errors", () => { const zonedDateTime = new Temporal.ZonedDateTime(1n, "UTC"); expect(() => { zonedDateTime.round({ smallestUnit: "second", roundingMode: "serenityOS" }); - }).toThrowWithMessage( - RangeError, - "serenityOS is not a valid value for option roundingMode" - ); + }).toThrowWithMessage(RangeError, "serenityOS is not a valid value for option roundingMode"); }); test("invalid smallest unit", () => { const zonedDateTime = new Temporal.ZonedDateTime(1n, "UTC"); expect(() => { zonedDateTime.round({ smallestUnit: "serenityOS" }); - }).toThrowWithMessage( - RangeError, - "serenityOS is not a valid value for option smallestUnit" - ); + }).toThrowWithMessage(RangeError, "serenityOS is not a valid value for option smallestUnit"); }); test("increment may not be NaN", () => { @@ -86,9 +76,6 @@ describe("errors", () => { }).toThrowWithMessage(RangeError, "0 is not a valid value for option roundingIncrement"); expect(() => { zonedDateTime.round({ smallestUnit: "second", roundingIncrement: Infinity }); - }).toThrowWithMessage( - RangeError, - "Infinity is not a valid value for option roundingIncrement" - ); + }).toThrowWithMessage(RangeError, "Infinity is not a valid value for option roundingIncrement"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.since.js b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.since.js index 3fe148aef5..7eade4ed11 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.since.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.since.js @@ -94,10 +94,7 @@ describe("rounding modes", () => { 1546935756_123_456_789n /* 2019-01-08T08:22:36.123456789+00:00 */, "UTC" ); - const later = new Temporal.ZonedDateTime( - 1631018380_987_654_289n /* 2021-09-07T12:39:40.987654289+00:00 */, - "UTC" - ); + const later = new Temporal.ZonedDateTime(1631018380_987_654_289n /* 2021-09-07T12:39:40.987654289+00:00 */, "UTC"); test("'ceil' rounding mode", () => { const expected = [ diff --git a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.toLocaleString.js b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.toLocaleString.js index ad13f755f4..df4ba96b0f 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.toLocaleString.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.toLocaleString.js @@ -4,18 +4,7 @@ describe("correct behavior", () => { }); test("basic functionality", () => { - const plainDateTime = new Temporal.PlainDateTime( - 2021, - 11, - 3, - 1, - 33, - 5, - 100, - 200, - 300, - "gregory" - ); + const plainDateTime = new Temporal.PlainDateTime(2021, 11, 3, 1, 33, 5, 100, 200, 300, "gregory"); const zonedDateTime = plainDateTime.toZonedDateTime("UTC"); expect(zonedDateTime.toLocaleString()).toBe("11/3/2021, 1:33:5 AM UTC"); }); @@ -29,18 +18,7 @@ describe("errors", () => { }); test("Temporal object must have same calendar", () => { - const plainDateTime = new Temporal.PlainDateTime( - 2021, - 11, - 3, - 1, - 33, - 5, - 100, - 200, - 300, - "gregory" - ); + const plainDateTime = new Temporal.PlainDateTime(2021, 11, 3, 1, 33, 5, 100, 200, 300, "gregory"); const zonedDateTime = plainDateTime.toZonedDateTime("UTC"); expect(() => { diff --git a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.until.js b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.until.js index 8d7c55c965..532ec49725 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.until.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.until.js @@ -93,10 +93,7 @@ describe("rounding modes", () => { 1546935756_123_456_789n /* 2019-01-08T08:22:36.123456789+00:00 */, "UTC" ); - const later = new Temporal.ZonedDateTime( - 1631018380_987_654_289n /* 2021-09-07T12:39:40.987654289+00:00 */, - "UTC" - ); + const later = new Temporal.ZonedDateTime(1631018380_987_654_289n /* 2021-09-07T12:39:40.987654289+00:00 */, "UTC"); test("'ceil' rounding mode", () => { const expected = [ diff --git a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.valueOf.js b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.valueOf.js index f358cf23b6..1a27455517 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.valueOf.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.valueOf.js @@ -3,9 +3,6 @@ describe("errors", () => { const timeZone = "UTC"; expect(() => { new Temporal.ZonedDateTime(0n, timeZone).valueOf(); - }).toThrowWithMessage( - TypeError, - "Cannot convert Temporal.ZonedDateTime to a primitive value" - ); + }).toThrowWithMessage(TypeError, "Cannot convert Temporal.ZonedDateTime to a primitive value"); }); }); diff --git a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.withPlainTime.js b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.withPlainTime.js index 2bb51ce542..1cd3c37f24 100644 --- a/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.withPlainTime.js +++ b/Libraries/LibJS/Tests/builtins/Temporal/ZonedDateTime/ZonedDateTime.prototype.withPlainTime.js @@ -59,12 +59,8 @@ describe("correct behavior", () => { const startOfDayZonedDateTime = zonedDateTime.startOfDay(); const withPlainTimeZonedDateTime = zonedDateTime.withPlainTime(); - expect(startOfDayZonedDateTime.epochNanoseconds).toBe( - withPlainTimeZonedDateTime.epochNanoseconds - ); - expect(startOfDayZonedDateTime.epochMilliseconds).toBe( - withPlainTimeZonedDateTime.epochMilliseconds - ); + expect(startOfDayZonedDateTime.epochNanoseconds).toBe(withPlainTimeZonedDateTime.epochNanoseconds); + expect(startOfDayZonedDateTime.epochMilliseconds).toBe(withPlainTimeZonedDateTime.epochMilliseconds); expect(startOfDayZonedDateTime.year).toBe(withPlainTimeZonedDateTime.year); expect(startOfDayZonedDateTime.month).toBe(withPlainTimeZonedDateTime.month); expect(startOfDayZonedDateTime.monthCode).toBe(withPlainTimeZonedDateTime.monthCode); @@ -84,9 +80,7 @@ describe("correct behavior", () => { expect(startOfDayZonedDateTime.monthsInYear).toBe(withPlainTimeZonedDateTime.monthsInYear); expect(startOfDayZonedDateTime.inLeapYear).toBe(withPlainTimeZonedDateTime.inLeapYear); expect(startOfDayZonedDateTime.offset).toBe(withPlainTimeZonedDateTime.offset); - expect(startOfDayZonedDateTime.offsetNanoseconds).toBe( - withPlainTimeZonedDateTime.offsetNanoseconds - ); + expect(startOfDayZonedDateTime.offsetNanoseconds).toBe(withPlainTimeZonedDateTime.offsetNanoseconds); }); test("from plain time string", () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js index 8450fa74c3..d51df64f26 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js @@ -112,31 +112,19 @@ test("typed array from ArrayBuffer with custom length and offset", () => { test("typed array from ArrayBuffer errors", () => { expect(() => { new Uint16Array(new ArrayBuffer(1)); - }).toThrowWithMessage( - RangeError, - "Invalid buffer length for Uint16Array: must be a multiple of 2, got 1" - ); + }).toThrowWithMessage(RangeError, "Invalid buffer length for Uint16Array: must be a multiple of 2, got 1"); expect(() => { new Uint16Array(new ArrayBuffer(), 1); - }).toThrowWithMessage( - RangeError, - "Invalid byte offset for Uint16Array: must be a multiple of 2, got 1" - ); + }).toThrowWithMessage(RangeError, "Invalid byte offset for Uint16Array: must be a multiple of 2, got 1"); expect(() => { new Uint16Array(new ArrayBuffer(), 2); - }).toThrowWithMessage( - RangeError, - "Typed array byte offset 2 is out of range for buffer with length 0" - ); + }).toThrowWithMessage(RangeError, "Typed array byte offset 2 is out of range for buffer with length 0"); expect(() => { new Uint16Array(new ArrayBuffer(7), 2, 3); - }).toThrowWithMessage( - RangeError, - "Typed array range 2:8 is out of range for buffer with length 7" - ); + }).toThrowWithMessage(RangeError, "Typed array range 2:8 is out of range for buffer with length 7"); }); test("typed array from TypedArray", () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.every.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.every.js index ae7a6ef2b3..8ce3e6c631 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.every.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.every.js @@ -18,10 +18,7 @@ describe("errors", () => { test(`requires at least one argument (${T.name})`, () => { expect(() => { new T().every(); - }).toThrowWithMessage( - TypeError, - "TypedArray.prototype.every() requires at least one argument" - ); + }).toThrowWithMessage(TypeError, "TypedArray.prototype.every() requires at least one argument"); }); test(`callback must be a function (${T.name})`, () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.filter.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.filter.js index bea0a5f62c..9b359c748f 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.filter.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.filter.js @@ -28,10 +28,7 @@ describe("errors", () => { test(`requires at least one argument (${T.name})`, () => { expect(() => { new T().filter(); - }).toThrowWithMessage( - TypeError, - "TypedArray.prototype.filter() requires at least one argument" - ); + }).toThrowWithMessage(TypeError, "TypedArray.prototype.filter() requires at least one argument"); }); test(`callback must be a function (${T.name})`, () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.find.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.find.js index 1270c9e34c..59622b534e 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.find.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.find.js @@ -28,10 +28,7 @@ describe("errors", () => { test(`requires at least one argument (${T.name})`, () => { expect(() => { new T().find(); - }).toThrowWithMessage( - TypeError, - "TypedArray.prototype.find() requires at least one argument" - ); + }).toThrowWithMessage(TypeError, "TypedArray.prototype.find() requires at least one argument"); }); test(`callback must be a function (${T.name})`, () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findIndex.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findIndex.js index 15a3cebcff..6de3728b4c 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findIndex.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findIndex.js @@ -28,10 +28,7 @@ describe("errors", () => { test(`requires at least one argument (${T.name})`, () => { expect(() => { new T().findIndex(); - }).toThrowWithMessage( - TypeError, - "TypedArray.prototype.findIndex() requires at least one argument" - ); + }).toThrowWithMessage(TypeError, "TypedArray.prototype.findIndex() requires at least one argument"); }); test(`callback must be a function (${T.name})`, () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLast.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLast.js index 77f27a2dd6..483eaadc04 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLast.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLast.js @@ -28,10 +28,7 @@ describe("errors", () => { test(`requires at least one argument (${T.name})`, () => { expect(() => { new T().findLast(); - }).toThrowWithMessage( - TypeError, - "TypedArray.prototype.findLast() requires at least one argument" - ); + }).toThrowWithMessage(TypeError, "TypedArray.prototype.findLast() requires at least one argument"); }); test(`callback must be a function (${T.name})`, () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLastIndex.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLastIndex.js index 70b2c84dc5..8abba8eb1f 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLastIndex.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLastIndex.js @@ -28,10 +28,7 @@ describe("errors", () => { test(`requires at least one argument (${T.name})`, () => { expect(() => { new T().findLastIndex(); - }).toThrowWithMessage( - TypeError, - "TypedArray.prototype.findLastIndex() requires at least one argument" - ); + }).toThrowWithMessage(TypeError, "TypedArray.prototype.findLastIndex() requires at least one argument"); }); test(`callback must be a function (${T.name})`, () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.forEach.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.forEach.js index bce4b55b32..8df5984891 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.forEach.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.forEach.js @@ -28,10 +28,7 @@ describe("errors", () => { test(`requires at least one argument (${T.name})`, () => { expect(() => { new T().forEach(); - }).toThrowWithMessage( - TypeError, - "TypedArray.prototype.forEach() requires at least one argument" - ); + }).toThrowWithMessage(TypeError, "TypedArray.prototype.forEach() requires at least one argument"); }); test(`callback must be a function (${T.name})`, () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.map.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.map.js index 7f565cab06..ba566bc5fa 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.map.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.map.js @@ -28,10 +28,7 @@ describe("errors", () => { test(`requires at least one argument (${T.name})`, () => { expect(() => { new T().map(); - }).toThrowWithMessage( - TypeError, - "TypedArray.prototype.map() requires at least one argument" - ); + }).toThrowWithMessage(TypeError, "TypedArray.prototype.map() requires at least one argument"); }); test(`callback must be a function (${T.name})`, () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.some.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.some.js index c5e232b222..e3dd19fd37 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.some.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.some.js @@ -18,10 +18,7 @@ describe("errors", () => { test(`requires at least one argument (${T.name})`, () => { expect(() => { new T().some(); - }).toThrowWithMessage( - TypeError, - "TypedArray.prototype.some() requires at least one argument" - ); + }).toThrowWithMessage(TypeError, "TypedArray.prototype.some() requires at least one argument"); }); test(`callback must be a function (${T.name})`, () => { diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-from-ArrayBuffer-bad-offset.js b/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-from-ArrayBuffer-bad-offset.js index 34c8d5d917..037e64e33e 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-from-ArrayBuffer-bad-offset.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-from-ArrayBuffer-bad-offset.js @@ -1,5 +1,3 @@ test("construct Uint32Array with zero-length ArrayBuffer and overflowing offset", () => { - expect(() => new Uint32Array(new ArrayBuffer(0), 4, 1024 * 1024 * 1024 - 1)).toThrow( - RangeError - ); + expect(() => new Uint32Array(new ArrayBuffer(0), 4, 1024 * 1024 * 1024 - 1)).toThrow(RangeError); }); diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-limits.js b/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-limits.js index dcf54d3d26..dd0ca47d5f 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-limits.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/typed-array-limits.js @@ -1,18 +1,6 @@ test("some oversized typed arrays", () => { - expect(() => new Uint8Array(2 * 1024 * 1024 * 1024)).toThrowWithMessage( - RangeError, - "Invalid typed array length" - ); - expect(() => new Uint16Array(2 * 1024 * 1024 * 1024)).toThrowWithMessage( - RangeError, - "Invalid typed array length" - ); - expect(() => new Uint32Array(1024 * 1024 * 1024)).toThrowWithMessage( - RangeError, - "Invalid typed array length" - ); - expect(() => new Uint32Array(4 * 1024 * 1024 * 1024)).toThrowWithMessage( - RangeError, - "Invalid typed array length" - ); + expect(() => new Uint8Array(2 * 1024 * 1024 * 1024)).toThrowWithMessage(RangeError, "Invalid typed array length"); + expect(() => new Uint16Array(2 * 1024 * 1024 * 1024)).toThrowWithMessage(RangeError, "Invalid typed array length"); + expect(() => new Uint32Array(1024 * 1024 * 1024)).toThrowWithMessage(RangeError, "Invalid typed array length"); + expect(() => new Uint32Array(4 * 1024 * 1024 * 1024)).toThrowWithMessage(RangeError, "Invalid typed array length"); }); diff --git a/Libraries/LibJS/Tests/builtins/functions/parseFloat.js b/Libraries/LibJS/Tests/builtins/functions/parseFloat.js index fa5be6e5b9..d31b6e7e12 100644 --- a/Libraries/LibJS/Tests/builtins/functions/parseFloat.js +++ b/Libraries/LibJS/Tests/builtins/functions/parseFloat.js @@ -60,22 +60,11 @@ test("parsing strings", () => { }); test("parsing NaN", () => { - [ - "", - [], - [], - true, - false, - null, - undefined, - NaN, - "foo123", - "foo+123", - "fooInfinity", - "foo+Infinity", - ].forEach(value => { - expect(parseFloat(value)).toBeNaN(); - }); + ["", [], [], true, false, null, undefined, NaN, "foo123", "foo+123", "fooInfinity", "foo+Infinity"].forEach( + value => { + expect(parseFloat(value)).toBeNaN(); + } + ); expect(parseFloat()).toBeNaN(); expect(parseFloat("", 123, Infinity)).toBeNaN(); diff --git a/Libraries/LibJS/Tests/classes/class-private-fields.js b/Libraries/LibJS/Tests/classes/class-private-fields.js index 30017ad78b..e75bc36338 100644 --- a/Libraries/LibJS/Tests/classes/class-private-fields.js +++ b/Libraries/LibJS/Tests/classes/class-private-fields.js @@ -159,27 +159,12 @@ test("unknown private name gives SyntaxError", () => { }); // OSS-FUZZ Issue 53363: top level unknown private names seg faults -expect(() => eval(`#n`)).toThrowWithMessage( - SyntaxError, - "Reference to undeclared private field or method '#n'" -); -expect(() => eval(`obj.#n`)).toThrowWithMessage( - SyntaxError, - "Reference to undeclared private field or method '#n'" -); -expect(() => eval(`this.#n`)).toThrowWithMessage( - SyntaxError, - "Reference to undeclared private field or method '#n'" -); +expect(() => eval(`#n`)).toThrowWithMessage(SyntaxError, "Reference to undeclared private field or method '#n'"); +expect(() => eval(`obj.#n`)).toThrowWithMessage(SyntaxError, "Reference to undeclared private field or method '#n'"); +expect(() => eval(`this.#n`)).toThrowWithMessage(SyntaxError, "Reference to undeclared private field or method '#n'"); expect(() => eval(`if (#n) 1;`)).toThrowWithMessage( SyntaxError, "Reference to undeclared private field or method '#n'" ); -expect(() => eval(`1?.#n`)).toThrowWithMessage( - SyntaxError, - "Reference to undeclared private field or method '#n'" -); -expect(() => eval(`1?.n.#n`)).toThrowWithMessage( - SyntaxError, - "Reference to undeclared private field or method '#n'" -); +expect(() => eval(`1?.#n`)).toThrowWithMessage(SyntaxError, "Reference to undeclared private field or method '#n'"); +expect(() => eval(`1?.n.#n`)).toThrowWithMessage(SyntaxError, "Reference to undeclared private field or method '#n'"); diff --git a/Libraries/LibJS/Tests/computed-property-sideeffects.js b/Libraries/LibJS/Tests/computed-property-sideeffects.js index 150d567d6d..b3f0e71850 100644 --- a/Libraries/LibJS/Tests/computed-property-sideeffects.js +++ b/Libraries/LibJS/Tests/computed-property-sideeffects.js @@ -139,7 +139,5 @@ test("Test toString and valueOf are only called once", () => { expect(object[2]).toBe("f"); expect(object[4]).toBe("g"); expect(object[8]).toBe("h"); - expect(Object.getOwnPropertyNames(object) + "").toBe( - ["0", "2", "4", "8", "a", "b", "c", "d"] + "" - ); + expect(Object.getOwnPropertyNames(object) + "").toBe(["0", "2", "4", "8", "a", "b", "c", "d"] + ""); }); diff --git a/Libraries/LibJS/Tests/eval-basic.js b/Libraries/LibJS/Tests/eval-basic.js index 0443d39662..d888c4a8f1 100644 --- a/Libraries/LibJS/Tests/eval-basic.js +++ b/Libraries/LibJS/Tests/eval-basic.js @@ -20,10 +20,7 @@ test("returns value of last value-producing statement", () => { test("syntax error", () => { expect(() => { eval("{"); - }).toThrowWithMessage( - SyntaxError, - "Unexpected token Eof. Expected CurlyClose (line: 1, column: 2)" - ); + }).toThrowWithMessage(SyntaxError, "Unexpected token Eof. Expected CurlyClose (line: 1, column: 2)"); }); test("returns 1st argument unless 1st argument is a string", () => { diff --git a/Libraries/LibJS/Tests/functions/arrow-functions.js b/Libraries/LibJS/Tests/functions/arrow-functions.js index b63e9cf307..7d75ecd512 100644 --- a/Libraries/LibJS/Tests/functions/arrow-functions.js +++ b/Libraries/LibJS/Tests/functions/arrow-functions.js @@ -119,10 +119,7 @@ test("cannot be constructed", () => { let foo = () => {}; expect(() => { new foo(); - }).toThrowWithMessage( - TypeError, - "[object ECMAScriptFunctionObject] is not a constructor (evaluated from 'foo')" - ); + }).toThrowWithMessage(TypeError, "[object ECMAScriptFunctionObject] is not a constructor (evaluated from 'foo')"); }); test("syntax errors", () => { diff --git a/Libraries/LibJS/Tests/functions/function-TypeError.js b/Libraries/LibJS/Tests/functions/function-TypeError.js index 41fb6ae196..af5298c8a4 100644 --- a/Libraries/LibJS/Tests/functions/function-TypeError.js +++ b/Libraries/LibJS/Tests/functions/function-TypeError.js @@ -22,26 +22,17 @@ test("calling undefined object key", () => { test("calling object", () => { expect(() => { Math(); - }).toThrowWithMessage( - TypeError, - "[object MathObject] is not a function (evaluated from 'Math')" - ); + }).toThrowWithMessage(TypeError, "[object MathObject] is not a function (evaluated from 'Math')"); }); test("constructing object", () => { expect(() => { new Math(); - }).toThrowWithMessage( - TypeError, - "[object MathObject] is not a constructor (evaluated from 'Math')" - ); + }).toThrowWithMessage(TypeError, "[object MathObject] is not a constructor (evaluated from 'Math')"); }); test("constructing native function", () => { expect(() => { new isNaN(); - }).toThrowWithMessage( - TypeError, - "[object NativeFunction] is not a constructor (evaluated from 'isNaN')" - ); + }).toThrowWithMessage(TypeError, "[object NativeFunction] is not a constructor (evaluated from 'isNaN')"); }); diff --git a/Libraries/LibJS/Tests/iterators/%IteratorPrototype%.js b/Libraries/LibJS/Tests/iterators/%IteratorPrototype%.js index efdb32e51a..adcb0dbfab 100644 --- a/Libraries/LibJS/Tests/iterators/%IteratorPrototype%.js +++ b/Libraries/LibJS/Tests/iterators/%IteratorPrototype%.js @@ -1,5 +1,4 @@ -const getIteratorPrototype = () => - Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())); +const getIteratorPrototype = () => Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())); test("prototype of %IteratorPrototype% is %ObjectPrototype%", () => { let itProto = getIteratorPrototype(); diff --git a/Libraries/LibJS/Tests/labels.js b/Libraries/LibJS/Tests/labels.js index c908f00151..317d351141 100644 --- a/Libraries/LibJS/Tests/labels.js +++ b/Libraries/LibJS/Tests/labels.js @@ -177,10 +177,7 @@ test("invalid label usage", () => { } } `) - ).toThrowWithMessage( - SyntaxError, - "labelled continue statement cannot use non iterating statement" - ); + ).toThrowWithMessage(SyntaxError, "labelled continue statement cannot use non iterating statement"); expect(() => eval(` diff --git a/Libraries/LibJS/Tests/modules/accessing-lex-import-before-decl.mjs b/Libraries/LibJS/Tests/modules/accessing-lex-import-before-decl.mjs index 1b96bf8aef..ef85409e6f 100644 --- a/Libraries/LibJS/Tests/modules/accessing-lex-import-before-decl.mjs +++ b/Libraries/LibJS/Tests/modules/accessing-lex-import-before-decl.mjs @@ -13,8 +13,7 @@ try { importedLexVariable = 0; passed = false; } catch (e) { - if (!(e instanceof TypeError)) - throw new Error("Expected importedLexVariable = 0; to throw TypeError got " + e); + if (!(e instanceof TypeError)) throw new Error("Expected importedLexVariable = 0; to throw TypeError got " + e); } import { value as importedLexVariable } from "./accessing-lex-import-before-decl.mjs"; diff --git a/Libraries/LibJS/Tests/modules/accessing-var-import-before-decl.mjs b/Libraries/LibJS/Tests/modules/accessing-var-import-before-decl.mjs index 44410c82df..3777fd9608 100644 --- a/Libraries/LibJS/Tests/modules/accessing-var-import-before-decl.mjs +++ b/Libraries/LibJS/Tests/modules/accessing-var-import-before-decl.mjs @@ -1,14 +1,12 @@ let passed = true; -if (importedVarValue !== undefined) - throw new Error("Expected importedVarValue === undefined; got " + importedVarValue); +if (importedVarValue !== undefined) throw new Error("Expected importedVarValue === undefined; got " + importedVarValue); try { importedVarValue = 0; passed = false; } catch (e) { - if (!(e instanceof TypeError)) - throw new Error("Expected importedVarValue = 0; to throw TypeError got " + e); + if (!(e instanceof TypeError)) throw new Error("Expected importedVarValue = 0; to throw TypeError got " + e); } import { value as importedVarValue } from "./accessing-var-import-before-decl.mjs"; diff --git a/Libraries/LibJS/Tests/modules/basic-modules.js b/Libraries/LibJS/Tests/modules/basic-modules.js index f28186c852..2e6ae76a53 100644 --- a/Libraries/LibJS/Tests/modules/basic-modules.js +++ b/Libraries/LibJS/Tests/modules/basic-modules.js @@ -3,9 +3,7 @@ function validTestModule(filename) { if (!filename.endsWith(".mjs") || !filename.startsWith("./")) { - throw new ExpectationError( - `Expected module name to start with './' and end with '.mjs' but got '${filename}'` - ); + throw new ExpectationError(`Expected module name to start with './' and end with '.mjs' but got '${filename}'`); } } @@ -207,12 +205,9 @@ describe("in- and exports", () => { expectModulePassed("./anon-func-decl-default-export.mjs"); }); - test.xfail( - "can have top level using declarations which trigger at the end of running a module", - () => { - expectModulePassed("./top-level-dispose.mjs"); - } - ); + test.xfail("can have top level using declarations which trigger at the end of running a module", () => { + expectModulePassed("./top-level-dispose.mjs"); + }); test("can export default a RegExp", () => { const result = expectModulePassed("./default-regexp-export.mjs"); @@ -250,10 +245,7 @@ describe("failing modules cascade", () => { }); test("importing a file re exports nothing from a file with a syntax error fails", () => { - expectedModuleToThrowSyntaxError( - "./exporting-nothing-from-failing.mjs", - failingModuleError - ); + expectedModuleToThrowSyntaxError("./exporting-nothing-from-failing.mjs", failingModuleError); }); }); diff --git a/Libraries/LibJS/Tests/modules/declarations-tests.mjs b/Libraries/LibJS/Tests/modules/declarations-tests.mjs index 1cccb86b8b..7f5e485c55 100644 --- a/Libraries/LibJS/Tests/modules/declarations-tests.mjs +++ b/Libraries/LibJS/Tests/modules/declarations-tests.mjs @@ -16,8 +16,7 @@ const didNotHoistClass = (() => { return 0; })(); -export const passed = - returnsOne() + hasStaticFieldTwo.two + shouldBeHoisted() + didNotHoistClass === expectedValue; +export const passed = returnsOne() + hasStaticFieldTwo.two + shouldBeHoisted() + didNotHoistClass === expectedValue; export function shouldBeHoisted() { return 3; diff --git a/Libraries/LibJS/Tests/modules/namespace-order.mjs b/Libraries/LibJS/Tests/modules/namespace-order.mjs index d9a0414429..b7c7145ced 100644 --- a/Libraries/LibJS/Tests/modules/namespace-order.mjs +++ b/Libraries/LibJS/Tests/modules/namespace-order.mjs @@ -10,7 +10,6 @@ if (keys[1] !== "*") throw new Error('Expected keys[1] === "*"'); if (keys[2] !== "default") throw new Error('Expected keys[2] === "default"'); -if (keys.indexOf(Symbol.toStringTag) <= 2) - throw new Error("Expected Symbol.toStringTag to be behind string keys"); +if (keys.indexOf(Symbol.toStringTag) <= 2) throw new Error("Expected Symbol.toStringTag to be behind string keys"); export const passed = true; diff --git a/Libraries/LibJS/Tests/modules/string-import-names.mjs b/Libraries/LibJS/Tests/modules/string-import-names.mjs index d61158f85a..33bc102ea5 100644 --- a/Libraries/LibJS/Tests/modules/string-import-names.mjs +++ b/Libraries/LibJS/Tests/modules/string-import-names.mjs @@ -1,9 +1,6 @@ import { "*" as starImport, "" as emptyImport } from "./default-and-star-export.mjs"; -import { - "*" as starImportIndirect, - "" as emptyImportIndirect, -} from "./default-and-star-export-indirect.mjs"; +import { "*" as starImportIndirect, "" as emptyImportIndirect } from "./default-and-star-export-indirect.mjs"; export const passed = starImport === "starExportValue" && diff --git a/Libraries/LibJS/Tests/null-or-undefined-access.js b/Libraries/LibJS/Tests/null-or-undefined-access.js index fd51cc1521..34627be78b 100644 --- a/Libraries/LibJS/Tests/null-or-undefined-access.js +++ b/Libraries/LibJS/Tests/null-or-undefined-access.js @@ -26,31 +26,19 @@ test("null/undefined object key", () => { expect(() => { foo.bar.baz; - }).toThrowWithMessage( - TypeError, - `Cannot access property "baz" on ${value} object "foo.bar"` - ); + }).toThrowWithMessage(TypeError, `Cannot access property "baz" on ${value} object "foo.bar"`); expect(() => { foo.bar.baz = 1; - }).toThrowWithMessage( - TypeError, - `Cannot access property "baz" on ${value} object "foo.bar"` - ); + }).toThrowWithMessage(TypeError, `Cannot access property "baz" on ${value} object "foo.bar"`); expect(() => { foo["bar"].baz; - }).toThrowWithMessage( - TypeError, - `Cannot access property "baz" on ${value} object "foo['bar']"` - ); + }).toThrowWithMessage(TypeError, `Cannot access property "baz" on ${value} object "foo['bar']"`); expect(() => { foo["bar"].baz = 1; - }).toThrowWithMessage( - TypeError, - `Cannot access property "baz" on ${value} object "foo['bar']"` - ); + }).toThrowWithMessage(TypeError, `Cannot access property "baz" on ${value} object "foo['bar']"`); }); }); @@ -61,30 +49,18 @@ test("null/undefined array index", () => { expect(() => { foo[0].bar; - }).toThrowWithMessage( - TypeError, - `Cannot access property "bar" on ${value} object "foo[0]"` - ); + }).toThrowWithMessage(TypeError, `Cannot access property "bar" on ${value} object "foo[0]"`); expect(() => { foo[0].bar = 1; - }).toThrowWithMessage( - TypeError, - `Cannot access property "bar" on ${value} object "foo[0]"` - ); + }).toThrowWithMessage(TypeError, `Cannot access property "bar" on ${value} object "foo[0]"`); expect(() => { foo[index].bar; - }).toThrowWithMessage( - TypeError, - `Cannot access property "bar" on ${value} object "foo[index]"` - ); + }).toThrowWithMessage(TypeError, `Cannot access property "bar" on ${value} object "foo[index]"`); expect(() => { foo[index].bar = 1; - }).toThrowWithMessage( - TypeError, - `Cannot access property "bar" on ${value} object "foo[index]"` - ); + }).toThrowWithMessage(TypeError, `Cannot access property "bar" on ${value} object "foo[index]"`); }); }); diff --git a/Libraries/LibJS/Tests/numeric-literals-basic.js b/Libraries/LibJS/Tests/numeric-literals-basic.js index ca07ad0ccc..0e0b64ba1d 100644 --- a/Libraries/LibJS/Tests/numeric-literals-basic.js +++ b/Libraries/LibJS/Tests/numeric-literals-basic.js @@ -58,10 +58,6 @@ test("out-of-range literals", () => { expect(0o2000000000000000000000).toBe(18446744073709552000); expect(-0o2000000000000000000000).toBe(-18446744073709552000); - expect(0b10000000000000000000000000000000000000000000000000000000000000000).toBe( - 18446744073709552000 - ); - expect(-0b10000000000000000000000000000000000000000000000000000000000000000).toBe( - -18446744073709552000 - ); + expect(0b10000000000000000000000000000000000000000000000000000000000000000).toBe(18446744073709552000); + expect(-0b10000000000000000000000000000000000000000000000000000000000000000).toBe(-18446744073709552000); }); diff --git a/Libraries/LibJS/Tests/object-basic.js b/Libraries/LibJS/Tests/object-basic.js index 0dfae4ce1a..c3203f6917 100644 --- a/Libraries/LibJS/Tests/object-basic.js +++ b/Libraries/LibJS/Tests/object-basic.js @@ -27,7 +27,8 @@ describe("correct behavior", () => { expect(o.foo).toBe("bar"); expect(o["foo"]).toBe("bar"); - expect(o.qux).toBe(10), expect(o.hello).toBe("friends"); + expect(o.qux).toBe(10); + expect(o.hello).toBe("friends"); expect(o["hello"]).toBe("friends"); }); @@ -247,15 +248,11 @@ describe("naming of anon functions", () => { }); test("getter has name", () => { - expect(Object.getOwnPropertyDescriptor({ get func() {} }, "func").get.name).toBe( - "get func" - ); + expect(Object.getOwnPropertyDescriptor({ get func() {} }, "func").get.name).toBe("get func"); }); test("setter has name", () => { - expect(Object.getOwnPropertyDescriptor({ set func(v) {} }, "func").set.name).toBe( - "set func" - ); + expect(Object.getOwnPropertyDescriptor({ set func(v) {} }, "func").set.name).toBe("set func"); }); test("anon function property", () => { diff --git a/Libraries/LibJS/Tests/parser-line-terminators.js b/Libraries/LibJS/Tests/parser-line-terminators.js index 63c7009f18..9fb09e43cb 100644 --- a/Libraries/LibJS/Tests/parser-line-terminators.js +++ b/Libraries/LibJS/Tests/parser-line-terminators.js @@ -13,46 +13,31 @@ function anonymous( test("LINE FEED is a line terminator", () => { expect(() => { Function("\n\n@"); - }).toThrowWithMessage( - SyntaxError, - "Unexpected token Invalid. Expected CurlyClose (line: 4, column: 1)" - ); + }).toThrowWithMessage(SyntaxError, "Unexpected token Invalid. Expected CurlyClose (line: 4, column: 1)"); }); test("CARRIAGE RETURN is a line terminator", () => { expect(() => { Function("\r\r@"); - }).toThrowWithMessage( - SyntaxError, - "Unexpected token Invalid. Expected CurlyClose (line: 4, column: 1)" - ); + }).toThrowWithMessage(SyntaxError, "Unexpected token Invalid. Expected CurlyClose (line: 4, column: 1)"); }); test("LINE SEPARATOR is a line terminator", () => { expect(() => { Function("

@"); - }).toThrowWithMessage( - SyntaxError, - "Unexpected token Invalid. Expected CurlyClose (line: 4, column: 1)" - ); + }).toThrowWithMessage(SyntaxError, "Unexpected token Invalid. Expected CurlyClose (line: 4, column: 1)"); }); test("PARAGRAPH SEPARATOR is a line terminator", () => { expect(() => { Function("

@"); - }).toThrowWithMessage( - SyntaxError, - "Unexpected token Invalid. Expected CurlyClose (line: 4, column: 1)" - ); + }).toThrowWithMessage(SyntaxError, "Unexpected token Invalid. Expected CurlyClose (line: 4, column: 1)"); }); test("CR LF is counted as only one line terminator", () => { expect(() => { Function("\r\n\r\n@"); - }).toThrowWithMessage( - SyntaxError, - "Unexpected token Invalid. Expected CurlyClose (line: 4, column: 1)" - ); + }).toThrowWithMessage(SyntaxError, "Unexpected token Invalid. Expected CurlyClose (line: 4, column: 1)"); }); test("LF/CR are not allowed in string literal", () => { @@ -70,10 +55,7 @@ test("LS/PS are allowed in string literal", () => { test("line terminators can be mixed (but please don't)", () => { expect(() => { Function("\r
\r\n
\n\r@"); - }).toThrowWithMessage( - SyntaxError, - "Unexpected token Invalid. Expected CurlyClose (line: 8, column: 1)" - ); + }).toThrowWithMessage(SyntaxError, "Unexpected token Invalid. Expected CurlyClose (line: 8, column: 1)"); }); test("all line terminators are valid for line continuations", () => { diff --git a/Libraries/LibJS/Tests/strict-mode-errors.js b/Libraries/LibJS/Tests/strict-mode-errors.js index 4954581373..a96309d4bb 100644 --- a/Libraries/LibJS/Tests/strict-mode-errors.js +++ b/Libraries/LibJS/Tests/strict-mode-errors.js @@ -2,18 +2,13 @@ test("basic functionality", () => { [true, false, "foo", 123, 123n, null, undefined].forEach(primitive => { - let description = `${typeof primitive} '${primitive}${ - typeof primitive == "bigint" ? "n" : "" - }'`; + let description = `${typeof primitive} '${primitive}${typeof primitive == "bigint" ? "n" : ""}'`; if (primitive == null) description = String(primitive); expect(() => { primitive.foo = "bar"; }).toThrowWithMessage(TypeError, `Cannot set property 'foo' of ${description}`); expect(() => { primitive[Symbol.hasInstance] = 123; - }).toThrowWithMessage( - TypeError, - `Cannot set property 'Symbol(Symbol.hasInstance)' of ${description}` - ); + }).toThrowWithMessage(TypeError, `Cannot set property 'Symbol(Symbol.hasInstance)' of ${description}`); }); }); diff --git a/Libraries/LibJS/Tests/tagged-template-literals.js b/Libraries/LibJS/Tests/tagged-template-literals.js index dea4c5ec2b..19017fa974 100644 --- a/Libraries/LibJS/Tests/tagged-template-literals.js +++ b/Libraries/LibJS/Tests/tagged-template-literals.js @@ -86,9 +86,7 @@ describe("tagged template literal functionality", () => { } var name = "SerenityOS"; var rating = "great"; - expect(review`${name} is a ${rating} project!`).toBe( - "**SerenityOS** is a _great_ project!" - ); + expect(review`${name} is a ${rating} project!`).toBe("**SerenityOS** is a _great_ project!"); }); test("template object structure", () => { diff --git a/Libraries/LibJS/Tests/test-common.js b/Libraries/LibJS/Tests/test-common.js index 30977525f7..85cdf37ccb 100644 --- a/Libraries/LibJS/Tests/test-common.js +++ b/Libraries/LibJS/Tests/test-common.js @@ -83,10 +83,7 @@ class ExpectationError extends Error { this.__doMatcher(() => { this.__expect( Object.is(this.target, value), - () => - `toBe: expected _${valueToString(value)}_, got _${valueToString( - this.target - )}_` + () => `toBe: expected _${valueToString(value)}_, got _${valueToString(this.target)}_` ); }); } @@ -123,10 +120,7 @@ class ExpectationError extends Error { } toHaveSize(size) { - this.__expect( - typeof this.target.size === "number", - () => "toHaveSize: target.size not of type number" - ); + this.__expect(typeof this.target.size === "number", () => "toHaveSize: target.size not of type number"); this.__doMatcher(() => { this.__expect(Object.is(this.target.size, size)); @@ -154,10 +148,7 @@ class ExpectationError extends Error { if (Array.isArray(property)) { for (let key of property) { - this.__expect( - object !== undefined && object !== null, - "got undefined or null as array key" - ); + this.__expect(object !== undefined && object !== null, "got undefined or null as array key"); object = object[key]; } } else { @@ -168,9 +159,7 @@ class ExpectationError extends Error { if (value !== undefined) this.__expect( deepEquals(object, value), - `value does not equal property ${valueToString(object)} vs ${valueToString( - value - )}` + `value does not equal property ${valueToString(object)} vs ${valueToString(value)}` ); }); } @@ -195,10 +184,7 @@ class ExpectationError extends Error { toBeNull() { this.__doMatcher(() => { - this.__expect( - this.target === null, - `Expected target to be null got ${valueToString(this.target)}` - ); + this.__expect(this.target === null, `Expected target to be null got ${valueToString(this.target)}`); }); } @@ -206,10 +192,7 @@ class ExpectationError extends Error { this.__doMatcher(() => { this.__expect( this.target === undefined, - () => - `toBeUndefined: expected target to be undefined, got _${valueToString( - this.target - )}_` + () => `toBeUndefined: expected target to be undefined, got _${valueToString(this.target)}_` ); }); } @@ -309,10 +292,7 @@ class ExpectationError extends Error { this.__doMatcher(() => { this.__expect( deepEquals(this.target, value), - () => - `Expected _${valueToString(value)}_, but got _${valueToString( - this.target - )}_` + () => `Expected _${valueToString(value)}_, but got _${valueToString(this.target)}_` ); }); } @@ -353,10 +333,7 @@ class ExpectationError extends Error { ); } } - this.__expect( - threw, - `Expected ${this.target.toString()} to throw but it didn't throw anything` - ); + this.__expect(threw, `Expected ${this.target.toString()} to throw but it didn't throw anything`); }); } @@ -422,9 +399,7 @@ class ExpectationError extends Error { try { result = eval(this.target); } catch (e) { - throw new ExpectationError( - `Expected _${valueToString(this.target)}_ to eval but it failed with ${e}` - ); + throw new ExpectationError(`Expected _${valueToString(this.target)}_ to eval but it failed with ${e}`); } this.__doMatcher(() => { @@ -524,9 +499,7 @@ class ExpectationError extends Error { this.__expect( this.target.done === true, () => - `toGiveIteratorResultDone: expected 'done' to be _true_ got ${valueToString( - this.target.done - )}` + `toGiveIteratorResultDone: expected 'done' to be _true_ got ${valueToString(this.target.done)}` ); this.__expect( this.target.value === undefined, diff --git a/Libraries/LibJS/Tests/try-finally-continue.js b/Libraries/LibJS/Tests/try-finally-continue.js index 4017cc7d9b..deff022261 100644 --- a/Libraries/LibJS/Tests/try-finally-continue.js +++ b/Libraries/LibJS/Tests/try-finally-continue.js @@ -337,10 +337,7 @@ test("Nested try/catch/finally with labelled continue", () => { expect(() => { continueTry; - }).toThrowWithMessage( - ReferenceError, - "'continueTry' is not defined" - ); + }).toThrowWithMessage(ReferenceError, "'continueTry' is not defined"); expect(foo).toBe(0); expect(j).toBe(1); @@ -361,10 +358,7 @@ test("Nested try/catch/finally with labelled continue", () => { expect(() => { beforeContinueTry; - }).toThrowWithMessage( - ReferenceError, - "'beforeContinueTry' is not defined" - ); + }).toThrowWithMessage(ReferenceError, "'beforeContinueTry' is not defined"); expect(() => { continueTry; diff --git a/Libraries/LibWasm/Tests/Parser/test-basic-load.js b/Libraries/LibWasm/Tests/Parser/test-basic-load.js index b2222d5b14..0b9c971fb7 100644 --- a/Libraries/LibWasm/Tests/Parser/test-basic-load.js +++ b/Libraries/LibWasm/Tests/Parser/test-basic-load.js @@ -31,10 +31,7 @@ test("parsing can pass", () => { test("parsing can fail", () => { let binary = new Uint8Array([0, 0x32, 0x73, 0x6d]); - expect(() => parseWebAssemblyModule(binary)).toThrow( - SyntaxError, - "Incorrect module magic (did not match \\0asm)" - ); + expect(() => parseWebAssemblyModule(binary)).toThrow(SyntaxError, "Incorrect module magic (did not match \\0asm)"); }); test("file reading can pass", () => { diff --git a/Tests/LibWeb/Text/input/GamepadAPI/gamepad-helper.js b/Tests/LibWeb/Text/input/GamepadAPI/gamepad-helper.js index 8b0a45fccc..415a18a435 100644 --- a/Tests/LibWeb/Text/input/GamepadAPI/gamepad-helper.js +++ b/Tests/LibWeb/Text/input/GamepadAPI/gamepad-helper.js @@ -28,17 +28,13 @@ globalThis.listenForGamepadConnected = () => { window.addEventListener("gamepadconnected", ({ gamepad }) => { - println( - `Received gamepadconnected event for '${gamepad.id}' at index ${gamepad.index}` - ); + println(`Received gamepadconnected event for '${gamepad.id}' at index ${gamepad.index}`); }); }; globalThis.listenForGamepadDisconnected = () => { window.addEventListener("gamepaddisconnected", ({ gamepad }) => { - println( - `Received gamepaddisconnected event for '${gamepad.id}' at index ${gamepad.index}` - ); + println(`Received gamepaddisconnected event for '${gamepad.id}' at index ${gamepad.index}`); }); }; })(); diff --git a/Tests/LibWeb/Text/input/include.js b/Tests/LibWeb/Text/input/include.js index dc09af17be..7136fc6479 100644 --- a/Tests/LibWeb/Text/input/include.js +++ b/Tests/LibWeb/Text/input/include.js @@ -132,7 +132,8 @@ const __httpTestServer = (function () { })(); function httpTestServer() { - if (!__httpTestServer) + if (!__httpTestServer) { throw new Error("window.internals must be exposed to use HTTPTestServer"); + } return __httpTestServer; }