Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: adds split chronicle functionality #29
- Loading branch information
1 parent
af04380
commit b0e673a
Showing
4 changed files
with
116 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { assert } from 'chai'; | ||
import Test from '../Test'; | ||
import chronicle from '../entry'; | ||
|
||
suite('Chronicle split'); | ||
|
||
const factory = new Test(chronicle); | ||
|
||
before(async () => { | ||
await factory.startMockApp(); | ||
await factory.cleanup(); | ||
await factory.setActions(); | ||
}); | ||
|
||
test('Split actions', function () { | ||
const splitted = chronicle.split(action => { | ||
return action.group; | ||
}); | ||
|
||
assert.lengthOf(chronicle._actions, 4); | ||
assert.lengthOf(splitted, 2); | ||
const userGroup = splitted.find(s => s.id === 'Users'); | ||
|
||
assert.lengthOf(userGroup._actions, 3); | ||
const orderGroup = splitted.find(s => s.id === 'Orders'); | ||
|
||
assert.lengthOf(orderGroup._actions, 1); | ||
}); | ||
|
||
after(async () => { | ||
await factory.cleanup(); | ||
}); |