forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.parallel.ts
36 lines (31 loc) · 1.16 KB
/
test.parallel.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import cdk = require('@aws-cdk/core');
import { Test } from 'nodeunit';
import stepfunctions = require('../lib');
export = {
'State Machine With Parallel State'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
// WHEN
const parallel = new stepfunctions.Parallel(stack, 'Parallel State');
parallel.branch(new stepfunctions.Pass(stack, 'Branch 1'));
parallel.branch(new stepfunctions.Pass(stack, 'Branch 2'));
// THEN
test.deepEqual(render(parallel), {
StartAt: 'Parallel State',
States: {
'Parallel State': {
Type: 'Parallel',
End: true,
Branches: [
{ StartAt: 'Branch 1', States: { 'Branch 1': { Type: 'Pass', End: true } } },
{ StartAt: 'Branch 2', States: { 'Branch 2': { Type: 'Pass', End: true } } }
]
}
}
});
test.done();
}
};
function render(sm: stepfunctions.IChainable) {
return new cdk.Stack().resolve(new stepfunctions.StateGraph(sm.startState, 'Test Graph').toGraphJson());
}