DataView.js 531 B

123456789101112131415
  1. test("basic functionality", () => {
  2. expect(DataView).toHaveLength(1);
  3. expect(DataView.name).toBe("DataView");
  4. expect(DataView.prototype.constructor).toBe(DataView);
  5. const buffer = new ArrayBuffer();
  6. expect(new DataView(buffer)).toBeInstanceOf(DataView);
  7. expect(typeof new DataView(buffer)).toBe("object");
  8. });
  9. test("DataView constructor must be invoked with 'new'", () => {
  10. expect(() => {
  11. DataView();
  12. }).toThrowWithMessage(TypeError, "DataView constructor must be called with 'new'");
  13. });