1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

LibJS: Add the DataView built-in object

This commit is contained in:
Idan Horowitz 2021-06-14 01:47:08 +03:00 committed by Linus Groh
parent 5b2255291e
commit e4d267d4fb
15 changed files with 351 additions and 0 deletions

View file

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