diff options
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r-- | Userland/Libraries/LibJS/Tests/test-common.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Userland/Libraries/LibJS/Tests/test-common.js b/Userland/Libraries/LibJS/Tests/test-common.js index eaf107d0ed..ec54dfddf2 100644 --- a/Userland/Libraries/LibJS/Tests/test-common.js +++ b/Userland/Libraries/LibJS/Tests/test-common.js @@ -65,8 +65,7 @@ class ExpectationError extends Error { this.__doMatcher(() => { this.__expect( Object.is(this.target, value), - () => - "toBe: expected _" + String(value) + "_, got _" + String(this.target) + "_" + () => `toBe: expected _${String(value)}_, got _${String(this.target)}_` ); }); } @@ -75,11 +74,11 @@ class ExpectationError extends Error { toBeCloseTo(value) { this.__expect( typeof this.target === "number", - () => "toBeCloseTo: target not of type number" + () => `toBeCloseTo: expected target of type number, got ${typeof value}` ); this.__expect( typeof value === "number", - () => "toBeCloseTo: argument not of type number" + () => `toBeCloseTo: expected argument of type number, got ${typeof value}` ); this.__doMatcher(() => { @@ -133,7 +132,10 @@ class ExpectationError extends Error { toBeDefined() { this.__doMatcher(() => { - this.__expect(this.target !== undefined, () => "toBeDefined: target was undefined"); + this.__expect( + this.target !== undefined, + () => "toBeDefined: expected target to be defined, got undefined" + ); }); } @@ -153,7 +155,10 @@ class ExpectationError extends Error { this.__doMatcher(() => { this.__expect( this.target === undefined, - () => "toBeUndefined: target was not undefined" + () => + `toBeUndefined: expected target to be undefined, got _${String( + this.target + )}_` ); }); } @@ -162,7 +167,7 @@ class ExpectationError extends Error { this.__doMatcher(() => { this.__expect( isNaN(this.target), - () => "toBeNaN: target was _" + String(this.target) + "_, not NaN" + () => `toBeNaN: expected target to be NaN, got _${String(this.target)}_` ); }); } |