@@ -476,7 +476,7 @@ describe('ServerlessStepFunctions', () => {
476476 } ) ;
477477
478478 describe ( '#compile()' , ( ) => {
479- beforeEach ( ( ) => {
479+ it ( 'should comple with correct params' , ( ) => {
480480 serverlessStepFunctions . stepFunctions = {
481481 stateMachine : {
482482 States : {
@@ -487,17 +487,36 @@ describe('ServerlessStepFunctions', () => {
487487 } ,
488488 } ;
489489 serverlessStepFunctions . functionArns . first = 'lambdaArn' ;
490- } ) ;
491-
492- it ( 'should comple with correct params'
493- , ( ) => serverlessStepFunctions . compile ( )
494- . then ( ( ) => {
495- expect ( serverlessStepFunctions . stepFunctions . stateMachine . States . HelloWorld . Resource )
496- . to . be . equal ( 'lambdaArn' ) ;
490+ serverlessStepFunctions . compile ( ) . then ( ( ) => {
497491 expect ( serverlessStepFunctions . awsStateLanguage . stateMachine )
498492 . to . be . equal ( '{"States":{"HelloWorld":{"Resource":"lambdaArn"}}}' ) ;
499- } )
500- ) ;
493+ } ) ;
494+ } ) ;
495+
496+ it ( 'should comple with correct params when nested Resource' , ( ) => {
497+ serverlessStepFunctions . stepFunctions = {
498+ stateMachine : {
499+ States : {
500+ HelloWorld : {
501+ Resource : 'first' ,
502+ HelloWorld : {
503+ Resource : 'first' ,
504+ HelloWorld : {
505+ Resource : 'first' ,
506+ } ,
507+ } ,
508+ } ,
509+ } ,
510+ } ,
511+ } ;
512+
513+ let a = '{"States":{"HelloWorld":{"Resource":"lambdaArn","HelloWorld"' ;
514+ a += ':{"Resource":"lambdaArn","HelloWorld":{"Resource":"lambdaArn"}}}}}' ;
515+ serverlessStepFunctions . functionArns . first = 'lambdaArn' ;
516+ serverlessStepFunctions . compile ( ) . then ( ( ) => {
517+ expect ( serverlessStepFunctions . awsStateLanguage . stateMachine ) . to . be . equal ( a ) ;
518+ } ) ;
519+ } ) ;
501520 } ) ;
502521} ) ;
503522
0 commit comments