1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +00:00

LibJS: Start implementing ShadowRealm

This commit adds the ShadowRealm object itself, its constructor, and
prototype (currently empty).
This commit is contained in:
Linus Groh 2021-10-13 21:09:45 +01:00
parent 50f8755792
commit d40331ef69
10 changed files with 216 additions and 0 deletions

View file

@ -0,0 +1,20 @@
describe("errors", () => {
test("called without new", () => {
expect(() => {
ShadowRealm();
}).toThrowWithMessage(TypeError, "ShadowRealm constructor must be called with 'new'");
});
});
describe("normal behavior", () => {
test("length is 0", () => {
expect(ShadowRealm).toHaveLength(0);
});
test("basic functionality", () => {
const shadowRealm = new ShadowRealm();
expect(typeof shadowRealm).toBe("object");
expect(shadowRealm).toBeInstanceOf(ShadowRealm);
expect(Object.getPrototypeOf(shadowRealm)).toBe(ShadowRealm.prototype);
});
});