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.

38 lines
769 B

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