-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest.js
24 lines (19 loc) · 790 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import test from 'ava';
import shortcutUrl from './index.js';
test('main', async t => {
t.is(await shortcutUrl('fixture/google'), 'https://google.com');
});
test('with extension', async t => {
t.is(await shortcutUrl('fixture/google.webloc'), 'https://google.com');
});
test('webloc with query, #2', async t => {
t.is(await shortcutUrl('fixture/youtube-with-query.webloc'), 'https://youtube.com/watch?v=XXXXXXXXXXX');
});
test('webloc complex query, #2', async t => {
t.is(await shortcutUrl('fixture/youtube-with-complex-query.webloc'), 'https://youtube.com/watch?complex=true&v=XXXXXXXXXXX');
});
test('unknown shortcut', async t => {
await t.throwsAsync(shortcutUrl('fixture/unknown.webloc'), {
message: 'Couldn\'t find a web shortcut with the name `unknown.webloc`',
});
});