Total Complexity | 6 |
Complexity/F | 1 |
Lines of Code | 51 |
Function Count | 6 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /* eslint-disable sonarjs/no-duplicate-string */ |
||
2 | import { assert } from 'chai'; |
||
3 | import { load } from '../Test'; |
||
4 | |||
5 | const { resolveUrl } = load('utils'); |
||
6 | |||
7 | suite('resolveUrl'); |
||
8 | |||
9 | test('use relativeUrl as absolute', async function () { |
||
10 | assert.equal( |
||
11 | resolveUrl('http://uvvewwik.pl/cob', 'http://tarku.gp/oje'), |
||
12 | 'http://tarku.gp/oje' |
||
13 | ); |
||
14 | }); |
||
15 | |||
16 | test('respect apiprefix', async function () { |
||
17 | assert.equal( |
||
18 | resolveUrl('http://uvvewwik.pl/cob', 'oje'), |
||
19 | 'http://uvvewwik.pl/cob/oje' |
||
20 | ); |
||
21 | }); |
||
22 | |||
23 | |||
24 | test('handle first / in relativeUrl', async function () { |
||
25 | assert.equal( |
||
26 | resolveUrl('http://uvvewwik.pl/cob', '/oje'), |
||
27 | 'http://uvvewwik.pl/cob/oje' |
||
28 | ); |
||
29 | }); |
||
30 | |||
31 | |||
32 | test('handle last / in baseUrl', async function () { |
||
33 | assert.equal( |
||
34 | resolveUrl('http://uvvewwik.pl/', '/oje'), |
||
35 | 'http://uvvewwik.pl/oje' |
||
36 | ); |
||
37 | }); |
||
38 | |||
39 | |||
40 | test('empty baseUrl', async function () { |
||
41 | assert.equal( |
||
42 | resolveUrl(null, 'http://nunpe.mn/tiv'), |
||
43 | 'http://nunpe.mn/tiv' |
||
44 | ); |
||
45 | }); |
||
46 | |||
47 | test('handle last / in apiprefix', async function () { |
||
48 | assert.equal( |
||
49 | resolveUrl('http://saero.mt/gum/', '/oje'), |
||
50 | 'http://saero.mt/gum/oje' |
||
51 | ); |
||
52 | }); |
||
53 |