From fb85fd4867d044bd9f6894dc4fd49ab4aeedf4f3 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 15 Oct 2021 00:12:28 +0100 Subject: [PATCH] LibJS/Tests: Test ShadowRealm.prototype.evaluate() this value type check --- .../builtins/ShadowRealm/ShadowRealm.prototype.evaluate.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.evaluate.js b/Userland/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.evaluate.js index 8f01cec94f..d301b4e5eb 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.evaluate.js +++ b/Userland/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.evaluate.js @@ -56,6 +56,12 @@ describe("normal behavior", () => { }); describe("errors", () => { + test("this value must be a ShadowRealm object", () => { + expect(() => { + ShadowRealm.prototype.evaluate.call("foo"); + }).toThrowWithMessage(TypeError, "Not an object of type ShadowRealm"); + }); + test("throws for non-string input", () => { const shadowRealm = new ShadowRealm(); const values = [