@@ -76,6 +76,55 @@ describe('#compileStateMachines', () => {
7676 ) . to . equal ( 'MyStateMachine2StepFunctionsStateMachine' ) ;
7777 } ) ;
7878
79+ it ( 'should create named resources when Name is provided' , ( ) => {
80+ serverless . service . stepFunctions = {
81+ stateMachines : {
82+ myStateMachine1 : {
83+ definition : 'definition1' ,
84+ Name : 'stateMachineBeta1' ,
85+ } ,
86+ myStateMachine2 : {
87+ definition : 'definition2' ,
88+ Name : 'stateMachineBeta2' ,
89+ } ,
90+ } ,
91+ } ;
92+
93+ serverlessStepFunctions . compileStateMachines ( ) ;
94+ expect ( serverlessStepFunctions . serverless . service
95+ . provider . compiledCloudFormationTemplate . Resources
96+ . StateMachineBeta1 . Type
97+ ) . to . equal ( 'AWS::StepFunctions::StateMachine' ) ;
98+ expect ( serverlessStepFunctions . serverless . service
99+ . provider . compiledCloudFormationTemplate . Resources
100+ . StateMachineBeta2 . Type
101+ ) . to . equal ( 'AWS::StepFunctions::StateMachine' ) ;
102+ expect ( serverlessStepFunctions . serverless . service
103+ . provider . compiledCloudFormationTemplate . Resources
104+ . StateMachineBeta1 . Properties . DefinitionString
105+ ) . to . equal ( '"definition1"' ) ;
106+ expect ( serverlessStepFunctions . serverless . service
107+ . provider . compiledCloudFormationTemplate . Resources
108+ . StateMachineBeta2 . Properties . DefinitionString
109+ ) . to . equal ( '"definition2"' ) ;
110+ expect ( serverlessStepFunctions . serverless . service
111+ . provider . compiledCloudFormationTemplate . Resources
112+ . StateMachineBeta1 . Properties . RoleArn [ 'Fn::GetAtt' ] [ 0 ]
113+ ) . to . equal ( 'IamRoleStateMachineExecution' ) ;
114+ expect ( serverlessStepFunctions . serverless . service
115+ . provider . compiledCloudFormationTemplate . Resources
116+ . StateMachineBeta2 . Properties . RoleArn [ 'Fn::GetAtt' ] [ 0 ]
117+ ) . to . equal ( 'IamRoleStateMachineExecution' ) ;
118+ expect ( serverlessStepFunctions . serverless . service
119+ . provider . compiledCloudFormationTemplate . Resources
120+ . StateMachineBeta1 . DependsOn
121+ ) . to . equal ( 'IamRoleStateMachineExecution' ) ;
122+ expect ( serverlessStepFunctions . serverless . service
123+ . provider . compiledCloudFormationTemplate . Resources
124+ . StateMachineBeta2 . DependsOn
125+ ) . to . equal ( 'IamRoleStateMachineExecution' ) ;
126+ } ) ;
127+
79128 it ( 'should create corresponding resources when definition and role property are given' , ( ) => {
80129 serverless . service . stepFunctions = {
81130 stateMachines : {
0 commit comments