Total Complexity | 6 |
Complexity/F | 1 |
Lines of Code | 32 |
Function Count | 6 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 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 |