mirror of https://github.com/lukechilds/ow.git
Sam Verschueren
7 years ago
committed by
Sindre Sorhus
5 changed files with 54 additions and 1 deletions
@ -0,0 +1,11 @@ |
|||
import test from 'ava'; |
|||
import m from '..'; |
|||
|
|||
test('undefined', t => { |
|||
const x = null; |
|||
|
|||
t.notThrows(() => m(null, m.null)); |
|||
t.notThrows(() => m(x, m.null)); |
|||
t.throws(() => m(undefined, m.null), 'Expected argument to be of type `null` but received type `undefined`'); |
|||
t.throws(() => m('foo', m.null), 'Expected argument to be of type `null` but received type `string`'); |
|||
}); |
@ -0,0 +1,8 @@ |
|||
import test from 'ava'; |
|||
import m from '..'; |
|||
|
|||
test('symbol', t => { |
|||
t.notThrows(() => m(Symbol.iterator, m.symbol)); |
|||
t.notThrows(() => m(Symbol('foo'), m.symbol)); |
|||
t.throws(() => m(12, m.symbol), 'Expected argument to be of type `symbol` but received type `number`'); |
|||
}); |
@ -0,0 +1,13 @@ |
|||
import test from 'ava'; |
|||
import m from '..'; |
|||
|
|||
test('undefined', t => { |
|||
let x; // tslint:disable-line:prefer-const
|
|||
const y = 12; |
|||
|
|||
t.notThrows(() => m(undefined, m.undefined)); |
|||
t.notThrows(() => m(x, m.undefined)); |
|||
t.throws(() => m(y, m.undefined), 'Expected argument to be of type `undefined` but received type `number`'); |
|||
t.throws(() => m(null, m.undefined), 'Expected argument to be of type `undefined` but received type `null`'); |
|||
t.throws(() => m('foo', m.undefined), 'Expected argument to be of type `undefined` but received type `string`'); |
|||
}); |
Loading…
Reference in new issue