Passed
Push — master ( 3b3ae1...0bee8f )
by Dmytro
02:00
created

tests/package/chronicle-split.test.js   A

Complexity

Total Complexity 6
Complexity/F 1

Size

Lines of Code 32
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 20
mnd 0
bc 0
fnc 6
dl 0
loc 32
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
import { assert } from 'chai';
2
import Test from '../Test';
3
import chronicle  from '../entry';
4
5
suite('Chronicle split');
6
7
const factory = new Test(chronicle);
8
9
before(async function () {
10
    await factory.startMockApp();
11
    await factory.cleanup();
12
    await factory.setActions();
13
});
14
15
test('Split actions', function () {
16
    const splitted = chronicle.split(action => {
17
        return action.group;
18
    });
19
20
    assert.lengthOf(chronicle._actions, 4);
21
    assert.lengthOf(splitted, 2);
22
    const userGroup = splitted.find(s => s.id === 'Users');
23
24
    assert.lengthOf(userGroup._actions, 3);
25
    const orderGroup = splitted.find(s => s.id === 'Orders');
26
27
    assert.lengthOf(orderGroup._actions, 1);
28
});
29
30
after(async function () {
31
    await factory.cleanup();
32
});
33