Explorar el Código

LibJS/Tests: Test ShadowRealm.prototype.evaluate() this value type check

Linus Groh hace 3 años
padre
commit
fb85fd4867

+ 6 - 0
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 = [