@@ -71,6 +71,48 @@ describe('invoke', () => {
7171 } ) ;
7272 } ) ;
7373
74+ it ( 'should return arn when correct params given with specifing name statement in serverless.yml'
75+ , ( ) => {
76+ getStateMachineStub = sinon . stub ( serverlessStepFunctions . provider , 'request' )
77+ . returns ( BbPromise . resolve ( {
78+ Stacks : [
79+ {
80+ Outputs : [
81+ {
82+ OutputKey : 'StatemachinenameArn' ,
83+ OutputValue : 'arn:aws:states:us-east-1:xxxx' ,
84+ Description : 'Current StateMachine Arn' } ,
85+ ] ,
86+ } ,
87+ ] ,
88+ } )
89+ ) ;
90+
91+ serverless . service . stepFunctions = {
92+ stateMachines : {
93+ myStateMachine : {
94+ name : 'statemachinename' ,
95+ definition : 'definition1' ,
96+ } ,
97+ } ,
98+ } ;
99+
100+ serverlessStepFunctions . getStateMachineArn ( )
101+ . then ( ( ) => {
102+ expect ( getStateMachineStub . calledOnce ) . to . be . equal ( true ) ;
103+ expect ( getStateMachineStub . calledWithExactly (
104+ 'CloudFormation' ,
105+ 'describeStacks' ,
106+ { StackName : 'new-service-dev' } ,
107+ serverlessStepFunctions . options . stage ,
108+ serverlessStepFunctions . options . region
109+ ) ) . to . be . equal ( true ) ;
110+ expect ( serverlessStepFunctions . stateMachineArn ) . to . be
111+ . equal ( 'arn:aws:states:us-east-1:xxxx' ) ;
112+ serverlessStepFunctions . provider . request . restore ( ) ;
113+ } ) ;
114+ } ) ;
115+
74116 it ( 'should throw error if correct params is not given'
75117 , ( ) => {
76118 getStateMachineStub = sinon . stub ( serverlessStepFunctions . provider , 'request' )
0 commit comments