summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/builtins
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-12-26 16:24:24 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-27 21:25:27 +0100
commit5122f98198e650f83e948a335e762aeeb306bbaa (patch)
treef00d89bcc36f1ff30176b32e03877005c54634df /Libraries/LibJS/Tests/builtins
parent76239f89c21fccec2278394f85a7c1a3f02c3c90 (diff)
downloadserenity-5122f98198e650f83e948a335e762aeeb306bbaa.zip
Base+LibJS+LibWeb: Make prettier clean
Also use "// prettier-ignore" comments where necessary rather than excluding whole files (via .prettierignore).
Diffstat (limited to 'Libraries/LibJS/Tests/builtins')
-rw-r--r--Libraries/LibJS/Tests/builtins/Array/Array.from.js3
-rw-r--r--Libraries/LibJS/Tests/builtins/Date/Date.js10
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-get.js13
-rw-r--r--Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js2
-rw-r--r--Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.flags.js1
-rw-r--r--Libraries/LibJS/Tests/builtins/String/String.prototype.endsWith.js5
6 files changed, 21 insertions, 13 deletions
diff --git a/Libraries/LibJS/Tests/builtins/Array/Array.from.js b/Libraries/LibJS/Tests/builtins/Array/Array.from.js
index fe0cdefefc..0a015f8141 100644
--- a/Libraries/LibJS/Tests/builtins/Array/Array.from.js
+++ b/Libraries/LibJS/Tests/builtins/Array/Array.from.js
@@ -50,8 +50,9 @@ describe("normal behavior", () => {
let value = begin - 1;
return {
next() {
- if (value < end)
+ if (value < end) {
value += 1;
+ }
return { value: value, done: value >= end };
},
};
diff --git a/Libraries/LibJS/Tests/builtins/Date/Date.js b/Libraries/LibJS/Tests/builtins/Date/Date.js
index e232b79137..cc76212e22 100644
--- a/Libraries/LibJS/Tests/builtins/Date/Date.js
+++ b/Libraries/LibJS/Tests/builtins/Date/Date.js
@@ -37,7 +37,7 @@ test("tuple constructor", () => {
expect(new Date(2019, 11).getMilliseconds()).toBe(0);
expect(new Date(2019, 11).getDay()).toBe(0);
- let date = new Date(2019, 11, 15, 9, 16, 14, 123); // Note: Month is 0-based.
+ let date = new Date(2019, 11, 15, 9, 16, 14, 123); // Note: Month is 0-based.
expect(date.getFullYear()).toBe(2019);
expect(date.getMonth()).toBe(11);
expect(date.getDate()).toBe(15);
@@ -48,14 +48,14 @@ test("tuple constructor", () => {
expect(date.getDay()).toBe(0);
// getTime() returns a time stamp in UTC, but we can at least check it's in the right interval, which will be true independent of the local timezone if the range is big enough.
- let timestamp_lower_bound = 1575072000000; // 2019-12-01T00:00:00Z
- let timestamp_upper_bound = 1577750400000; // 2019-12-31T00:00:00Z
+ let timestamp_lower_bound = 1575072000000; // 2019-12-01T00:00:00Z
+ let timestamp_upper_bound = 1577750400000; // 2019-12-31T00:00:00Z
expect(date.getTime()).toBeGreaterThan(timestamp_lower_bound);
expect(date.getTime()).toBeLessThan(timestamp_upper_bound);
});
test("tuple constructor overflow", () => {
- let date = new Date(2019, 13, 33, 30, 70, 80, 2345);
+ let date = new Date(2019, 13, 33, 30, 70, 80, 2345);
expect(date.getFullYear()).toBe(2020);
expect(date.getMonth()).toBe(2);
expect(date.getDate()).toBe(5);
@@ -65,7 +65,7 @@ test("tuple constructor overflow", () => {
expect(date.getMilliseconds()).toBe(345);
expect(date.getDay()).toBe(4);
- let date = new Date(2019, -13, -33, -30, -70, -80, -2345);
+ let date = new Date(2019, -13, -33, -30, -70, -80, -2345);
expect(date.getFullYear()).toBe(2017);
expect(date.getMonth()).toBe(9);
expect(date.getDate()).toBe(26);
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-get.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-get.js
index 9d9ab486c9..7919b196fe 100644
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-get.js
+++ b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-get.js
@@ -42,11 +42,14 @@ describe("[[Get]] trap normal behavior", () => {
});
test("custom receiver value", () => {
- let p = new Proxy({}, {
- get(target, property, receiver) {
- return receiver;
- },
- });
+ let p = new Proxy(
+ {},
+ {
+ get(target, property, receiver) {
+ return receiver;
+ },
+ }
+ );
expect(Reflect.get(p, "foo", 42)).toBe(42);
});
diff --git a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js
index ef1a75c48a..dd45c51b4b 100644
--- a/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js
+++ b/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-set.js
@@ -40,7 +40,7 @@ describe("[[Set]] trap normal behavior", () => {
expect(p.foo).toBe(20);
p.foo = 10;
expect(p.foo).toBe(10);
- p[Symbol.hasInstance] = "foo"
+ p[Symbol.hasInstance] = "foo";
expect(p[Symbol.hasInstance]).toBe("foo");
});
diff --git a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.flags.js b/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.flags.js
index b6445d0b22..9ccc0b614e 100644
--- a/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.flags.js
+++ b/Libraries/LibJS/Tests/builtins/RegExp/RegExp.prototype.flags.js
@@ -6,5 +6,6 @@ test("basic functionality", () => {
expect(/foo/s.flags).toBe("s");
expect(/foo/u.flags).toBe("u");
expect(/foo/y.flags).toBe("y");
+ // prettier-ignore
expect(/foo/sgimyu.flags).toBe("gimsuy");
});
diff --git a/Libraries/LibJS/Tests/builtins/String/String.prototype.endsWith.js b/Libraries/LibJS/Tests/builtins/String/String.prototype.endsWith.js
index ef39541ce1..286cc6b1b2 100644
--- a/Libraries/LibJS/Tests/builtins/String/String.prototype.endsWith.js
+++ b/Libraries/LibJS/Tests/builtins/String/String.prototype.endsWith.js
@@ -34,6 +34,9 @@ test("basic functionality", () => {
expect(s.endsWith("", -1)).toBeTrue();
expect(s.endsWith("", 42)).toBeTrue();
expect("12undefined".endsWith()).toBeTrue();
- expect(() => s.endsWith(/foobar/)).toThrowWithMessage(TypeError, "searchString is not a string, but a regular expression");
+ expect(() => s.endsWith(/foobar/)).toThrowWithMessage(
+ TypeError,
+ "searchString is not a string, but a regular expression"
+ );
expect(s.endsWith("bar", undefined)).toBeTrue();
});