@@ -370,6 +370,112 @@ describe('#compileStateMachines', () => {
370
370
expect ( actual ) . to . equal ( JSON . stringify ( definition , undefined , 2 ) ) ;
371
371
} ) ;
372
372
373
+ it ( 'should use raw values for Seconds for Wait task' , ( ) => {
374
+ const definition = {
375
+ Comment : 'Hello World' ,
376
+ StartAt : 'HelloWorld' ,
377
+ States : {
378
+ HelloWorld : {
379
+ Type : 'Wait' ,
380
+ Seconds : { Ref : 'SomeSeconds' } ,
381
+ End : true ,
382
+ } ,
383
+ } ,
384
+ } ;
385
+
386
+ serverless . service . stepFunctions = {
387
+ stateMachines : {
388
+ myStateMachine1 : {
389
+ name : 'stateMachineBeta1' ,
390
+ definition,
391
+ } ,
392
+ } ,
393
+ } ;
394
+
395
+ serverlessStepFunctions . compileStateMachines ( ) ;
396
+ const actual = serverlessStepFunctions
397
+ . serverless
398
+ . service
399
+ . provider
400
+ . compiledCloudFormationTemplate
401
+ . Resources
402
+ . StateMachineBeta1
403
+ . Properties
404
+ . DefinitionString ;
405
+
406
+ expect ( actual [ 'Fn::Sub' ] [ 0 ] ) . to . equal ( `
407
+ {
408
+ "Comment": "Hello World",
409
+ "StartAt": "HelloWorld",
410
+ "States": {
411
+ "HelloWorld": {
412
+ "Type": "Wait",
413
+ "Seconds": \${4dfb8832166d083d5c26a32fbfcaebf9},
414
+ "End": true
415
+ }
416
+ }
417
+ }
418
+ ` . trim ( ) ) ;
419
+ } ) ;
420
+
421
+ it ( 'should not use raw values for Seconds in other task' , ( ) => {
422
+ const definition = {
423
+ Comment : 'Hello World' ,
424
+ StartAt : 'HelloWorld' ,
425
+ States : {
426
+ HelloWorld : {
427
+ Type : 'Task' ,
428
+ Resource : 'arn:aws:states:::glue:startJobRun.sync' ,
429
+ Parameters : {
430
+ Seconds : { Ref : 'SomeSeconds' } ,
431
+ } ,
432
+ TimeoutSecondsPath : '$.params.maxTime' ,
433
+ HeartbeatSecondsPath : '$.params.heartbeat' ,
434
+ End : true ,
435
+ } ,
436
+ } ,
437
+ } ;
438
+
439
+ serverless . service . stepFunctions = {
440
+ stateMachines : {
441
+ myStateMachine1 : {
442
+ name : 'stateMachineBeta1' ,
443
+ definition,
444
+ } ,
445
+ } ,
446
+ } ;
447
+
448
+ serverlessStepFunctions . compileStateMachines ( ) ;
449
+ const actual = serverlessStepFunctions
450
+ . serverless
451
+ . service
452
+ . provider
453
+ . compiledCloudFormationTemplate
454
+ . Resources
455
+ . StateMachineBeta1
456
+ . Properties
457
+ . DefinitionString ;
458
+
459
+ expect ( actual [ 'Fn::Sub' ] [ 0 ] ) . to . equal ( `
460
+ {
461
+ "Comment": "Hello World",
462
+ "StartAt": "HelloWorld",
463
+ "States": {
464
+ "HelloWorld": {
465
+ "Type": "Task",
466
+ "Resource": "arn:aws:states:::glue:startJobRun.sync",
467
+ "Parameters": {
468
+ "Seconds": "\${4dfb8832166d083d5c26a32fbfcaebf9}"
469
+ },
470
+ "TimeoutSecondsPath": "$.params.maxTime",
471
+ "HeartbeatSecondsPath": "$.params.heartbeat",
472
+ "End": true
473
+ }
474
+ }
475
+ }
476
+ ` . trim ( ) ) ;
477
+ } ) ;
478
+
373
479
it ( 'should add dependsOn resources' , ( ) => {
374
480
serverless . service . stepFunctions = {
375
481
stateMachines : {
0 commit comments