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.
11 lines
634 B
11 lines
634 B
import test from 'ava';
|
|
import m from '..';
|
|
|
|
test('promise', t => {
|
|
t.notThrows(() => m(Promise.resolve(), m.promise));
|
|
t.notThrows(() => m(new Promise(resolve => resolve()), m.promise));
|
|
t.notThrows(() => m(new Promise(resolve => resolve()), m.promise.label('foo')));
|
|
t.throws(() => m('foo' as any, m.promise), 'Expected argument to be of type `Promise` but received type `string`');
|
|
t.throws(() => m('foo' as any, m.promise.label('foo')), 'Expected `foo` to be of type `Promise` but received type `string`');
|
|
t.throws(() => m(12 as any, m.promise), 'Expected argument to be of type `Promise` but received type `number`');
|
|
});
|
|
|