test/uri/join.spec.js   A
last analyzed

Complexity

Total Complexity 9
Complexity/F 1

Size

Lines of Code 107
Function Count 9

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 107
rs 10
wmc 9
mnd 0
bc 9
fnc 9
bpm 1
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A join.spec.js ➔ ??? 0 7 1
1
import test from 'ava';
2
import join from '../../src/uri/join';
3
4
test('empty path', t => {
5
6
    t.is(
7
        join(),
8
        '/'
9
    );
10
});
11
12
test('path with null', t => {
13
    t.is(
14
        join('path', 'with', null),
15
        'path/with'
16
    );
17
});
18
19
test('path with boolean', t => {
20
    t.is(
21
        join('path', 'with', false),
22
        'path/with',
23
        'false'
24
    );
25
26
    t.is(
27
        join('path', 'with', true),
28
        'path/with/true',
29
        'true'
30
    );
31
});
32
33
34
test('path with numbers', t => {
35
    t.is(
36
        join('path', 'with', 1),
37
        'path/with/1',
38
        '1'
39
    );
40
41
    t.is(
42
        join('path', 'with', 0),
43
        'path/with/0',
44
        '0'
45
    );
46
47
    t.is(
48
        join('path', 'with', Infinity),
49
        'path/with/Infinity',
50
        'Infinity'
51
    );
52
53
    t.is(
54
        join('path', 'with', NaN),
55
        'path/with',
56
        'NaN'
57
    );
58
});
59
60
test('path with undefined', t => {
61
    t.is(
62
        join('path', 'with', undefined),
63
        'path/with'
64
    );
65
});
66
67
test('path with slashes', t => {
68
    t.is(
69
        join('/path//', '//with/', '///slashes'),
70
        '/path/with/slashes',
71
        'slashes'
72
    );
73
74
    t.is(
75
        join('/path//', '//with/', '///more///slashes///'),
76
        '/path/with/more/slashes/',
77
        'more slashes'
78
    );
79
});
80
81
test('path with array', t => {
82
    t.is(
83
        join('path', 'with', []),
84
        'path/with',
85
        'empty array'
86
    );
87
88
    t.is(
89
        join('path', 'with', ['t', 'e', 's', 't']),
90
        'path/with/t,e,s,t',
91
        'regular array'
92
    );
93
});
94
95
test('path with object', t => {
96
    t.is(
97
        join('path', 'with', {}),
98
        'path/with/[object Object]'
99
    );
100
});
101
102
test('path with regexp', t => {
103
    t.is(
104
        join('path', 'with', /^$/),
105
        'path/with/^$/'
106
    );
107
});