@@ -336,7 +336,7 @@ describe('#compileStateMachines', () => {
336336 States : {
337337 HelloWorld : {
338338 Type : 'Task' ,
339- Resource : 'arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId} :function:hello' ,
339+ Resource : 'arn:aws:lambda:us-east-1:1234567890 :function:hello' ,
340340 End : true ,
341341 } ,
342342 } ,
@@ -1108,4 +1108,45 @@ describe('#compileStateMachines', () => {
11081108 // Definition is invalid and validate=true, should throw
11091109 expect ( ( ) => serverlessStepFunctions . compileStateMachines ( ) ) . to . throw ( Error ) ;
11101110 } ) ;
1111+
1112+ it ( 'should replace pseudo parameters that starts with #' , ( ) => {
1113+ const definition = {
1114+ StartAt : 'A' ,
1115+ States : {
1116+ A : {
1117+ Type : 'Task' ,
1118+ Resource : 'arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:hello' ,
1119+ End : true ,
1120+ } ,
1121+ } ,
1122+ } ;
1123+
1124+ serverless . service . stepFunctions = {
1125+ stateMachines : {
1126+ myStateMachine1 : {
1127+ name : 'stateMachineBeta1' ,
1128+ definition,
1129+ } ,
1130+ } ,
1131+ } ;
1132+
1133+ serverlessStepFunctions . compileStateMachines ( ) ;
1134+ const actual = serverlessStepFunctions
1135+ . serverless
1136+ . service
1137+ . provider
1138+ . compiledCloudFormationTemplate
1139+ . Resources
1140+ . StateMachineBeta1
1141+ . Properties
1142+ . DefinitionString ;
1143+
1144+ expect ( actual ) . to . haveOwnProperty ( 'Fn::Sub' ) ;
1145+ const [ definitionString , params ] = actual [ 'Fn::Sub' ] ;
1146+ expect ( definitionString ) . to . contain ( '${AWS::Region}' ) ;
1147+ expect ( definitionString ) . to . not . contain ( '#{AWS::Region}' ) ;
1148+ expect ( definitionString ) . to . contain ( '${AWS::AccountId}' ) ;
1149+ expect ( definitionString ) . to . not . contain ( '#{AWS::AccountId}' ) ;
1150+ expect ( params ) . to . deep . equal ( { } ) ;
1151+ } ) ;
11111152} ) ;
0 commit comments