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:
parent
5b2255291e
commit
e4d267d4fb
15 changed files with 351 additions and 0 deletions
15
Userland/Libraries/LibJS/Tests/builtins/DataView/DataView.js
Normal file
15
Userland/Libraries/LibJS/Tests/builtins/DataView/DataView.js
Normal 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'");
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue