Add is.urlInstance (#60)

This commit is contained in:
Artur Androsovych 2018-07-10 12:04:20 +03:00 committed by Sindre Sorhus
parent c8736c2972
commit 3bdaf21475
3 changed files with 23 additions and 1 deletions

View file

@ -3,6 +3,7 @@ import net from 'net';
import Stream from 'stream';
import util from 'util';
import tempy from 'tempy';
import {URL} from 'url';
import test, {TestContext, Context} from 'ava';
import {JSDOM} from 'jsdom';
import {Subject, Observable} from 'rxjs';
@ -534,6 +535,14 @@ test('is.directInstanceOf', t => {
t.false(m.directInstanceOf(errorSubclass, Error));
});
test('is.urlInstance', t => {
const url = new URL('https://www.example.com');
t.true(m.urlInstance(url));
t.false(m.urlInstance({}));
t.false(m.urlInstance(undefined));
t.false(m.urlInstance(null));
});
test('is.truthy', t => {
t.true(m.truthy('unicorn'));
t.true(m.truthy('🦄'));