@@ -154,6 +154,15 @@ describe('dataProsessing', () => {
154154 } )
155155 ) ;
156156
157+ it ( 'should parse file if path param is provided when absolute path' , ( ) => {
158+ serverlessStepFunctions . options . path = '/data.json' ;
159+ serverlessStepFunctions . parseInputdate ( ) . then ( ( ) => {
160+ expect ( serverlessStepFunctions . options . data ) . to . deep . equal ( '{"foo":"var"}' ) ;
161+ serverlessStepFunctions . serverless . utils . fileExistsSync . restore ( ) ;
162+ serverlessStepFunctions . serverless . utils . readFileSync . restore ( ) ;
163+ } ) ;
164+ } ) ;
165+
157166 it ( 'should return resolve if path param is not provided' , ( ) => {
158167 serverlessStepFunctions . options . path = null ;
159168 return serverlessStepFunctions . parseInputdate ( ) . then ( ( ) => {
@@ -189,6 +198,33 @@ describe('dataProsessing', () => {
189198 } ) ;
190199
191200 describe ( '#compileAll()' , ( ) => {
192- // todo
201+ it ( 'should throw error when stepFunction state does not exists' , ( ) => {
202+ expect ( ( ) => serverlessStepFunctions . compileAll ( ) ) . to . throw ( Error ) ;
203+ } ) ;
204+
205+ it ( 'should comple with correct params when nested Resource' , ( ) => {
206+ serverlessStepFunctions . serverless . service . stepFunctions = {
207+ hellofunc : {
208+ States : {
209+ HelloWorld : {
210+ Resource : 'first' ,
211+ HelloWorld : {
212+ Resource : 'first' ,
213+ HelloWorld : {
214+ Resource : 'first' ,
215+ } ,
216+ } ,
217+ } ,
218+ } ,
219+ } ,
220+ } ;
221+
222+ let a = '{"States":{"HelloWorld":{"Resource":"lambdaArn","HelloWorld"' ;
223+ a += ':{"Resource":"lambdaArn","HelloWorld":{"Resource":"lambdaArn"}}}}}' ;
224+ serverlessStepFunctions . functionArns . first = 'lambdaArn' ;
225+ serverlessStepFunctions . compileAll ( ) . then ( ( ) => {
226+ expect ( serverlessStepFunctions . serverless . service . stepFunctions . hellofunc ) . to . be . equal ( a ) ;
227+ } ) ;
228+ } ) ;
193229 } ) ;
194230} ) ;
0 commit comments