@@ -1742,12 +1742,27 @@ describe('#compileStateMachines', () => {
17421742 States : {
17431743 'Store inputs' : {
17441744 Type : 'Pass' ,
1745- Next : 'Output transformation ' ,
1745+ Next : 'Get Current Price ' ,
17461746 Assign : {
17471747 desiredPrice : '{% $states.input.desired_price %}' ,
17481748 maximumWait : '{% $states.input.max_days %}' ,
17491749 } ,
17501750 } ,
1751+ 'Get Current Price' : {
1752+ Type : 'Task' ,
1753+ QueryLanguage : 'JSONata' ,
1754+ Resource : 'arn:aws:states:::lambda:invoke' ,
1755+ Next : 'Output transformation' ,
1756+ Arguments : {
1757+ Payload : {
1758+ product : '{% $states.context.Execution.Input.product %}' ,
1759+ } ,
1760+ FunctionName : 'arn:aws:lambda:<region>:123456789012:function:priceWatcher:$LATEST' ,
1761+ } ,
1762+ Assign : {
1763+ currentPrice : '{% $states.result.Payload.current_price %}' ,
1764+ } ,
1765+ } ,
17511766 'Output transformation' : {
17521767 Type : 'Succeed' ,
17531768 Output : {
@@ -1771,13 +1786,23 @@ describe('#compileStateMachines', () => {
17711786 expect ( stateMachine . Properties . DefinitionString ) . not . to . haveOwnProperty ( 'Fn::Sub' ) ;
17721787 const stateMachineObj = JSON . parse ( stateMachine . Properties . DefinitionString ) ;
17731788 expect ( stateMachineObj . States ) . to . haveOwnProperty ( 'Store inputs' ) ;
1789+ expect ( stateMachineObj . States ) . to . haveOwnProperty ( 'Get Current Price' ) ;
17741790 expect ( stateMachineObj . States ) . to . haveOwnProperty ( 'Output transformation' ) ;
17751791
17761792 expect ( stateMachineObj . QueryLanguage ) . to . equal ( 'JSONata' ) ;
17771793 expect ( stateMachineObj . States [ 'Store inputs' ] . Assign ) . to . deep . equal ( {
17781794 desiredPrice : '{% $states.input.desired_price %}' ,
17791795 maximumWait : '{% $states.input.max_days %}' ,
17801796 } ) ;
1797+ expect ( stateMachineObj . States [ 'Get Current Price' ] . Arguments ) . to . deep . equal ( {
1798+ Payload : {
1799+ product : '{% $states.context.Execution.Input.product %}' ,
1800+ } ,
1801+ FunctionName : 'arn:aws:lambda:<region>:123456789012:function:priceWatcher:$LATEST' ,
1802+ } ) ;
1803+ expect ( stateMachineObj . States [ 'Get Current Price' ] . Assign ) . to . deep . equal ( {
1804+ currentPrice : '{% $states.result.Payload.current_price %}' ,
1805+ } ) ;
17811806 expect ( stateMachineObj . States [ 'Output transformation' ] . Output ) . to . deep . equal ( {
17821807 lastName : "{% 'Last=>' & $states.input.customer.lastName %}" ,
17831808 orderValue : '{% $states.input.order.total %}' ,
0 commit comments