mirror of https://github.com/lukechilds/ow.git
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.
24 lines
580 B
24 lines
580 B
import test from 'ava';
|
|
import ow from '../source';
|
|
|
|
test('buffer', t => {
|
|
t.notThrows(() => {
|
|
ow(Buffer.alloc(2), ow.buffer);
|
|
});
|
|
|
|
t.notThrows(() => {
|
|
ow(Buffer.from('f'), ow.buffer);
|
|
});
|
|
|
|
t.throws(() => {
|
|
ow('foo' as any, ow.buffer);
|
|
}, 'Expected argument to be of type `Buffer` but received type `string`');
|
|
|
|
t.throws(() => {
|
|
ow('foo' as any, 'foo', ow.buffer);
|
|
}, 'Expected `foo` to be of type `Buffer` but received type `string`');
|
|
|
|
t.throws(() => {
|
|
ow(12 as any, ow.buffer);
|
|
}, 'Expected argument to be of type `Buffer` but received type `number`');
|
|
});
|
|
|