فهرست منبع

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

Linus Groh 3 سال پیش
والد
کامیت
fb85fd4867
1فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 6 0
      Userland/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.prototype.evaluate.js

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