diff options
author | Linus Groh <mail@linusgroh.de> | 2020-11-11 21:37:40 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-12 10:14:00 +0100 |
commit | 1b0c862f3af03e42e039c7e6639d365e22ee6463 (patch) | |
tree | ee7a401c4db44a590ce5dcf4da4beb1ac4809b98 /Libraries/LibJS/Tests | |
parent | b07c7f589f995ce057e28e75d60b3a14962d39e4 (diff) | |
download | serenity-1b0c862f3af03e42e039c7e6639d365e22ee6463.zip |
LibJS: Throw TypeError when calling class constructor without 'new'
Diffstat (limited to 'Libraries/LibJS/Tests')
-rw-r--r-- | Libraries/LibJS/Tests/classes/class-constructor.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Libraries/LibJS/Tests/classes/class-constructor.js b/Libraries/LibJS/Tests/classes/class-constructor.js index 9800ffabba..54a601e10c 100644 --- a/Libraries/LibJS/Tests/classes/class-constructor.js +++ b/Libraries/LibJS/Tests/classes/class-constructor.js @@ -46,18 +46,18 @@ test("constructor length affects class length", () => { expect(B).toHaveLength(2); }); -test.skip("must be invoked with 'new'", () => { +test("must be invoked with 'new'", () => { class A { constructor() {} } expect(() => { A(); - }).toThrow(TypeError); // FIXME: Add message when this test works + }).toThrowWithMessage(TypeError, "Class constructor A must be called with 'new'"); expect(() => { A.prototype.constructor(); - }).toThrow(TypeError); // FIXME: Add message when this test works + }).toThrowWithMessage(TypeError, "Class constructor A must be called with 'new'"); }); test("implicit constructor", () => { |