File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -742,4 +742,45 @@ describe('#compileStateMachines', () => {
742742
743743 expect ( stateMachine . Properties . DefinitionString ) . to . not . equal ( null ) ;
744744 } ) ;
745+
746+ it ( 'should not interpret states starting with "Ref" as intrinsic functions #203' , ( ) => {
747+ serverless . service . stepFunctions = {
748+ stateMachines : {
749+ myStateMachine1 : {
750+ id : 'Test' ,
751+ name : 'test' ,
752+ definition : {
753+ StartAt : 'One' ,
754+ States : {
755+ One : {
756+ Type : 'Wait' ,
757+ Seconds : 10 ,
758+ Next : 'RefreshLead' ,
759+ } ,
760+ RefreshLead : {
761+ Type : 'Task' ,
762+ Resource : 'arn:aws:lambda:us-east-1:12345:function:test-dev-lambda' ,
763+ TimeoutSeconds : 60 ,
764+ Next : 'EndState' ,
765+ } ,
766+ EndState : {
767+ Type : 'Succeed' ,
768+ } ,
769+ } ,
770+ } ,
771+ } ,
772+ } ,
773+ } ;
774+
775+ serverlessStepFunctions . compileStateMachines ( ) ;
776+ const stateMachine = serverlessStepFunctions . serverless . service
777+ . provider . compiledCloudFormationTemplate . Resources
778+ . Test ;
779+
780+ expect ( stateMachine . Properties . DefinitionString ) . to . not . haveOwnProperty ( 'Fn::Sub' ) ;
781+ const stateMachineObj = JSON . parse ( stateMachine . Properties . DefinitionString ) ;
782+ expect ( stateMachineObj . States ) . to . haveOwnProperty ( 'One' ) ;
783+ expect ( stateMachineObj . States ) . to . haveOwnProperty ( 'RefreshLead' ) ;
784+ expect ( stateMachineObj . States ) . to . haveOwnProperty ( 'EndState' ) ;
785+ } ) ;
745786} ) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const _ = require('lodash');
22
33function isIntrinsic ( obj ) {
44 return _ . isObjectLike ( obj ) &&
5- Object . keys ( obj ) . some ( ( k ) => k . startsWith ( 'Fn::' ) || k . startsWith ( 'Ref' ) ) ;
5+ Object . keys ( obj ) . some ( ( k ) => k . startsWith ( 'Fn::' ) || k === 'Ref' ) ;
66}
77
88module . exports = {
You can’t perform that action at this time.
0 commit comments