File: test.js

package info (click to toggle)
node-prepend-http 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 104 kB
  • sloc: makefile: 2; sh: 2
file content (23 lines) | stat: -rw-r--r-- 870 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import test from 'ava';
import m from '.';

test('prepend http', t => {
	t.is(m('todomvc.com'), 'http://todomvc.com');
	t.is(m('http://todomvc.com'), 'http://todomvc.com');
	t.is(m('https://todomvc.com'), 'https://todomvc.com');
	t.is(m('//todomvc.com'), '//todomvc.com');
	t.is(m('localhost'), 'http://localhost');
	t.is(m('localhost:8000'), 'http://localhost:8000');
	t.is(m('localhost:8000  '), 'http://localhost:8000');
	t.is(m('./relative'), './relative');
	t.is(m('../relative'), '../relative');
	t.is(m('/relative'), '/relative');
	t.is(m('mailto:info@site.com'), 'mailto:info@site.com');
	t.is(m('tel:1234567890'), 'tel:1234567890');
});

test('https option', t => {
	t.is(m('todomvc.com', {https: true}), 'https://todomvc.com');
	t.is(m('//todomvc.com', {https: true}), '//todomvc.com');
	t.is(m('localhost:8000', {https: true}), 'https://localhost:8000');
});