|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
959 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var test = require('tape');
|
|---|
| 4 | var forEach = require('for-each');
|
|---|
| 5 | var v = require('es-value-fixtures');
|
|---|
| 6 | var inspect = require('object-inspect');
|
|---|
| 7 |
|
|---|
| 8 | var dataViewBuffer = require('../');
|
|---|
| 9 |
|
|---|
| 10 | test('dataViewBuffer', function (t) {
|
|---|
| 11 | forEach(
|
|---|
| 12 | // @ts-expect-error TS sucks at [].concat
|
|---|
| 13 | // eslint-disable-next-line no-extra-parens
|
|---|
| 14 | /** @type {[...typeof v.primitives, ...typeof v.objects]} */ ([].concat(v.primitives, v.objects)),
|
|---|
| 15 | function (nonDV) {
|
|---|
| 16 | t['throws'](function () { dataViewBuffer(nonDV); }, TypeError, inspect(nonDV) + ' is not a DataView');
|
|---|
| 17 | }
|
|---|
| 18 | );
|
|---|
| 19 |
|
|---|
| 20 | t.test('DataView', { skip: typeof DataView !== 'function' }, function (st) {
|
|---|
| 21 | var ab = new ArrayBuffer(1);
|
|---|
| 22 | var dv = new DataView(ab);
|
|---|
| 23 |
|
|---|
| 24 | st.equal(dataViewBuffer(dv), ab, inspect(dv) + ' has the same buffer originally passed to the DataView');
|
|---|
| 25 | st.equal(dataViewBuffer(dv), dv.buffer, inspect(dv) + ' has the same buffer as its own buffer property');
|
|---|
| 26 |
|
|---|
| 27 | st.end();
|
|---|
| 28 | });
|
|---|
| 29 |
|
|---|
| 30 | t.end();
|
|---|
| 31 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.