summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-11-11 22:01:33 +0000
committerAndreas Kling <kling@serenityos.org>2020-11-12 10:14:57 +0100
commit8694d804c7391c9f4215b5c567fed0877317aeb0 (patch)
treed5a7756a58f4ded6f6f1d5e3aa7a82eecf775e52 /Libraries/LibJS/Tests
parent1b0c862f3af03e42e039c7e6639d365e22ee6463 (diff)
downloadserenity-8694d804c7391c9f4215b5c567fed0877317aeb0.zip
LibJS: Run prettier on test-common.js
Diffstat (limited to 'Libraries/LibJS/Tests')
-rw-r--r--Libraries/LibJS/Tests/test-common.js41
1 files changed, 30 insertions, 11 deletions
diff --git a/Libraries/LibJS/Tests/test-common.js b/Libraries/LibJS/Tests/test-common.js
index b5a4663246..f7c8c83539 100644
--- a/Libraries/LibJS/Tests/test-common.js
+++ b/Libraries/LibJS/Tests/test-common.js
@@ -63,15 +63,24 @@ class ExpectationError extends Error {
toBe(value) {
this.__doMatcher(() => {
- this.__expect(Object.is(this.target, value),
- () => ("toBe: expected _" + String(value) + "_, got _" + String(this.target) + "_"));
+ this.__expect(
+ Object.is(this.target, value),
+ () =>
+ "toBe: expected _" + String(value) + "_, got _" + String(this.target) + "_"
+ );
});
}
// FIXME: Take a precision argument like jest's toBeCloseTo matcher
toBeCloseTo(value) {
- this.__expect(typeof this.target === "number", () => "toBeCloseTo: target not of type number");
- this.__expect(typeof value === "number", () => "toBeCloseTo: argument not of type number");
+ this.__expect(
+ typeof this.target === "number",
+ () => "toBeCloseTo: target not of type number"
+ );
+ this.__expect(
+ typeof value === "number",
+ () => "toBeCloseTo: argument not of type number"
+ );
this.__doMatcher(() => {
this.__expect(Math.abs(this.target - value) < 0.000001);
@@ -79,7 +88,10 @@ class ExpectationError extends Error {
}
toHaveLength(length) {
- this.__expect(typeof this.target.length === "number", () => "toHaveLength: target.length not of type number");
+ this.__expect(
+ typeof this.target.length === "number",
+ () => "toHaveLength: target.length not of type number"
+ );
this.__doMatcher(() => {
this.__expect(Object.is(this.target.length, length));
@@ -139,13 +151,19 @@ class ExpectationError extends Error {
toBeUndefined() {
this.__doMatcher(() => {
- this.__expect(this.target === undefined, () => "toBeUndefined: target was not undefined");
+ this.__expect(
+ this.target === undefined,
+ () => "toBeUndefined: target was not undefined"
+ );
});
}
toBeNaN() {
this.__doMatcher(() => {
- this.__expect(isNaN(this.target), () => ("toBeNaN: target was _" + String(this.target) + "_, not NaN"));
+ this.__expect(
+ isNaN(this.target),
+ () => "toBeNaN: target was _" + String(this.target) + "_, not NaN"
+ );
});
}
@@ -388,10 +406,11 @@ class ExpectationError extends Error {
__expect(value, details) {
if (value !== true) {
- if (details !== undefined)
- throw new ExpectationError(details());
- else
- throw new ExpectationError();
+ if (details !== undefined) {
+ throw new ExpectationError(details());
+ } else {
+ throw new ExpectationError();
+ }
}
}
}