ladybird/Userland/Libraries/LibJS/Tests/builtins/ShadowRealm/ShadowRealm.js
Linus Groh d40331ef69 LibJS: Start implementing ShadowRealm
This commit adds the ShadowRealm object itself, its constructor, and
prototype (currently empty).
2021-10-14 00:41:41 +01:00

20 lines
633 B
JavaScript

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);
});
});