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.

27 lines
741 B

import test from 'ava';
import toHost from '../lib/to-host';
test('simple', async t => {
t.is(toHost('zeit.co'), 'zeit.co');
});
test('leading //', async t => {
t.is(toHost('//zeit-logos-rnemgaicnc.now.sh'), 'zeit-logos-rnemgaicnc.now.sh');
});
test('leading http://', async t => {
t.is(toHost('http://zeit-logos-rnemgaicnc.now.sh'), 'zeit-logos-rnemgaicnc.now.sh');
});
test('leading https://', async t => {
t.is(toHost('https://zeit-logos-rnemgaicnc.now.sh'), 'zeit-logos-rnemgaicnc.now.sh');
});
test('leading https:// and path', async t => {
t.is(toHost('https://zeit-logos-rnemgaicnc.now.sh/path'), 'zeit-logos-rnemgaicnc.now.sh');
});
test('simple and path', async t => {
t.is(toHost('zeit.co/test'), 'zeit.co');
});