@@ -15,6 +15,7 @@ describe('dataProsessing', () => {
1515 serverless = new Serverless ( ) ;
1616 serverless . servicePath = true ;
1717 serverless . service . service = 'step-functions' ;
18+ serverless . service . stepFunctions = { } ;
1819 serverless . service . functions = {
1920 first : {
2021 handler : true ,
@@ -42,15 +43,21 @@ describe('dataProsessing', () => {
4243 let yamlParserStub ;
4344 beforeEach ( ( ) => {
4445 yamlParserStub = sinon . stub ( serverlessStepFunctions . serverless . yamlParser , 'parse' )
45- . returns ( BbPromise . resolve ( { stepFunctions : { stateMachines : 'stepFunctions' } } ) ) ;
46+ . returns ( BbPromise . resolve ( {
47+ stepFunctions : {
48+ stateMachines : 'stepFunctions' ,
49+ activities : 'my-activity' ,
50+ } ,
51+ } ) ) ;
4652 serverlessStepFunctions . serverless . config . servicePath = 'servicePath' ;
4753 } ) ;
4854
4955 it ( 'should yamlParse with correct params'
5056 , ( ) => serverlessStepFunctions . yamlParse ( )
5157 . then ( ( ) => {
5258 expect ( yamlParserStub . calledOnce ) . to . be . equal ( true ) ;
53- expect ( serverless . service . stepFunctions ) . to . be . equal ( 'stepFunctions' ) ;
59+ expect ( serverless . service . stepFunctions . stateMachines ) . to . be . equal ( 'stepFunctions' ) ;
60+ expect ( serverless . service . stepFunctions . activities ) . to . be . equal ( 'my-activity' ) ;
5461 serverlessStepFunctions . serverless . yamlParser . parse . restore ( ) ;
5562 } )
5663 ) ;
@@ -67,11 +74,17 @@ describe('dataProsessing', () => {
6774 it ( 'should return resolve when variables exists in the yaml' , ( ) => {
6875 serverlessStepFunctions . serverless . yamlParser . parse . restore ( ) ;
6976 yamlParserStub = sinon . stub ( serverlessStepFunctions . serverless . yamlParser , 'parse' )
70- . returns ( BbPromise . resolve ( { stepFunctions : { stateMachines : '${self:defaults.region}' } } ) ) ;
77+ . returns ( BbPromise . resolve ( {
78+ stepFunctions : {
79+ stateMachines : '${self:defaults.region}' ,
80+ activities : '${self:defaults.region}' ,
81+ } ,
82+ } ) ) ;
7183 serverlessStepFunctions . yamlParse ( )
7284 . then ( ( ) => {
7385 expect ( yamlParserStub . calledOnce ) . to . be . equal ( true ) ;
74- expect ( serverless . service . stepFunctions ) . to . be . equal ( 'us-east-1' ) ;
86+ expect ( serverless . service . stepFunctions . stateMachines ) . to . be . equal ( 'us-east-1' ) ;
87+ expect ( serverless . service . stepFunctions . activities ) . to . be . equal ( 'us-east-1' ) ;
7588 } ) ;
7689 } ) ;
7790 } ) ;
@@ -87,7 +100,7 @@ describe('dataProsessing', () => {
87100 } ) ;
88101
89102 it ( 'should comple with correct params' , ( ) => {
90- serverless . service . stepFunctions = {
103+ serverless . service . stepFunctions . stateMachines = {
91104 hellofunc : {
92105 States : {
93106 HelloWorld : {
@@ -98,13 +111,13 @@ describe('dataProsessing', () => {
98111 } ;
99112 serverlessStepFunctions . functionArns . first = 'lambdaArn' ;
100113 serverlessStepFunctions . compile ( ) . then ( ( ) => {
101- expect ( serverlessStepFunctions . serverless . service . stepFunctions . hellofunc )
114+ expect ( serverlessStepFunctions . serverless . service . stepFunctions . stateMachines . hellofunc )
102115 . to . be . equal ( '{"States":{"HelloWorld":{"Resource":"lambdaArn"}}}' ) ;
103116 } ) ;
104117 } ) ;
105118
106119 it ( 'should comple with correct params when nested Resource' , ( ) => {
107- serverlessStepFunctions . serverless . service . stepFunctions = {
120+ serverlessStepFunctions . serverless . service . stepFunctions . stateMachines = {
108121 hellofunc : {
109122 States : {
110123 HelloWorld : {
@@ -124,7 +137,8 @@ describe('dataProsessing', () => {
124137 a += ':{"Resource":"lambdaArn","HelloWorld":{"Resource":"lambdaArn"}}}}}' ;
125138 serverlessStepFunctions . functionArns . first = 'lambdaArn' ;
126139 serverlessStepFunctions . compile ( ) . then ( ( ) => {
127- expect ( serverlessStepFunctions . serverless . service . stepFunctions . hellofunc ) . to . be . equal ( a ) ;
140+ expect ( serverlessStepFunctions . serverless . service . stepFunctions . stateMachines . hellofunc )
141+ . to . be . equal ( a ) ;
128142 } ) ;
129143 } ) ;
130144 } ) ;
@@ -203,7 +217,7 @@ describe('dataProsessing', () => {
203217 } ) ;
204218
205219 it ( 'should comple with correct params when nested Resource' , ( ) => {
206- serverlessStepFunctions . serverless . service . stepFunctions = {
220+ serverlessStepFunctions . serverless . service . stepFunctions . stateMachines = {
207221 hellofunc : {
208222 States : {
209223 HelloWorld : {
@@ -223,7 +237,8 @@ describe('dataProsessing', () => {
223237 a += ':{"Resource":"lambdaArn","HelloWorld":{"Resource":"lambdaArn"}}}}}' ;
224238 serverlessStepFunctions . functionArns . first = 'lambdaArn' ;
225239 serverlessStepFunctions . compileAll ( ) . then ( ( ) => {
226- expect ( serverlessStepFunctions . serverless . service . stepFunctions . hellofunc ) . to . be . equal ( a ) ;
240+ expect ( serverlessStepFunctions . serverless . service . stepFunctions . stateMachines . hellofunc )
241+ . to . be . equal ( a ) ;
227242 } ) ;
228243 } ) ;
229244 } ) ;
0 commit comments