Completed
Push — master ( f1fe92...87cf16 )
by Joachim
15:15
created

test.js   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 28
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 0
nc 1
dl 0
loc 28
rs 10
c 1
b 0
f 1
wmc 3
mnd 0
bc 3
fnc 3
bpm 1
cpm 1
noi 0
1
const f = require('./index');
2
3
test('check referrer', () => {
4
    let d = getTestDocument();
5
    d.referrer = 'google';
6
7
    const lastClick = f(d);
8
    lastClick.check();
9
    expect(lastClick.getLastClick()).toBe('google');
10
});
11
12
test('check location', () => {
13
    let d = getTestDocument();
14
    d.location.search = '?utm_source=example.com';
15
16
    const lastClick = f(d);
17
    lastClick.check();
18
    expect(lastClick.getLastClick()).toBe('example.com');
19
});
20
21
function getTestDocument() {
22
    return {
23
        referrer: '',
24
        location: {
25
            search: ''
26
        }
27
    };
28
}