LibJS: Add ArrayBuffer

This commit is contained in:
Linus Groh 2020-12-02 20:49:31 +00:00 committed by Andreas Kling
commit 32571dfa53
Notes: sideshowbarker 2024-07-19 01:05:04 +09:00
14 changed files with 426 additions and 11 deletions

View file

@ -0,0 +1,13 @@
test("basic functionality", () => {
expect(ArrayBuffer).toHaveLength(1);
expect(ArrayBuffer.name).toBe("ArrayBuffer");
expect(ArrayBuffer.prototype.constructor).toBe(ArrayBuffer);
expect(new ArrayBuffer()).toBeInstanceOf(ArrayBuffer);
expect(typeof new ArrayBuffer()).toBe("object");
});
test("ArrayBuffer constructor must be invoked with 'new'", () => {
expect(() => {
ArrayBuffer();
}).toThrowWithMessage(TypeError, "ArrayBuffer constructor must be called with 'new'");
});