Passed
Push — master ( b19941...141797 )
by Dmytro
02:06 queued 11s
created

tests/package/configurations.test.js   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 40
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 21
mnd 0
bc 0
fnc 3
dl 0
loc 40
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
/* eslint-disable no-secrets/no-secrets */
2
import CSV from '../entry';
3
import { testFormatter } from '../utils';
4
import Factory from '../Test';
5
6
const factory = new Factory();
7
8
suite('Configurations');
9
10
before(async function () {
11
    await factory.cleanTmpFolder();
12
    await factory.setTmpFolder();
13
});
14
15
test('Positive: default configuration', async function () {
16
    const formatter = CSV([ 'user', 'action' ]);
17
    const data = [
18
        { user: 'e3c0b365-26fd-54fc-afd7-d844c1d47a95', action: 'CREATE_POST' },
19
        { user: '', action: 'UPDATE_POST' },
20
        { user: 'e3c0b365-26fd-54fc-afd7-d844c1d47a95' },
21
        {},
22
        { user: 'e3c0b365-26fd-54fc-afd7-d844c1d47a95', time: '2019-08-06T11:46:46.434Z' },
23
        { action: 'DELETE_POST', user: 'e595b156-f526-5b94-ab76-c9fb610e286b' }
24
    ];
25
26
    const expected = `\
27
e3c0b365-26fd-54fc-afd7-d844c1d47a95;CREATE_POST
28
;UPDATE_POST
29
e3c0b365-26fd-54fc-afd7-d844c1d47a95;
30
;
31
e3c0b365-26fd-54fc-afd7-d844c1d47a95;
32
e595b156-f526-5b94-ab76-c9fb610e286b;DELETE_POST
33
`;
34
35
    await testFormatter(formatter, data, expected);
36
});
37
38
39
after(async function () {
40
    await factory.cleanTmpFolder();
41
});
42