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.
12 lines
520 B
12 lines
520 B
import test from 'ava';
|
|
import ow from '..';
|
|
|
|
test('null', t => {
|
|
const x = null;
|
|
|
|
t.notThrows(() => ow(null, ow.null));
|
|
t.notThrows(() => ow(x, ow.null));
|
|
t.throws(() => ow(undefined as any, ow.null), 'Expected argument to be of type `null` but received type `undefined`');
|
|
t.throws(() => ow(undefined as any, 'foo', ow.null), 'Expected `foo` to be of type `null` but received type `undefined`');
|
|
t.throws(() => ow('foo' as any, ow.null), 'Expected argument to be of type `null` but received type `string`');
|
|
});
|
|
|