You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

20 lines
589 B

import test from 'ava';
import ow from '../source';
test('dataView', t => {
t.notThrows(() => {
ow(new DataView(new ArrayBuffer(1)), ow.dataView);
});
t.throws(() => {
ow(new ArrayBuffer(1) as any, ow.dataView);
}, 'Expected argument to be of type `DataView` but received type `ArrayBuffer`');
t.throws(() => {
ow(new ArrayBuffer(1) as any, 'data', ow.dataView);
}, 'Expected `data` to be of type `DataView` but received type `ArrayBuffer`');
t.throws(() => {
ow(12 as any, ow.dataView);
}, 'Expected argument to be of type `DataView` but received type `number`');
});