Skip to content

Commit

Permalink
test: add test case for Fn::Sub
Browse files Browse the repository at this point in the history
  • Loading branch information
theburningmonk committed Jun 10, 2019
1 parent 6c202f9 commit d224278
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/deploy/stepFunctions/compileIamRole.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1230,11 +1230,20 @@ describe('#compileIamRole', () => {
// function name can be...
const lambda1 = { Ref: 'MyFunction' }; // name
const lambda2 = { 'Fn::GetAtt': ['MyFunction', 'Arn'] }; // Arn
const lambda3 = { // or, something we don't need special handling for
'Fn::Sub': [
'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${FunctionName}',
{
FunctionName: 'myFunction',
},
],
};

serverless.service.stepFunctions = {
stateMachines: {
myStateMachine1: getStateMachine('sm1', lambda1),
myStateMachine2: getStateMachine('sm2', lambda2),
myStateMachine3: getStateMachine('sm3', lambda3),
},
};

Expand All @@ -1260,6 +1269,14 @@ describe('#compileIamRole', () => {
'Arn',
],
},
{
'Fn::Sub': [
'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${FunctionName}',
{
FunctionName: 'myFunction',
},
],
},
];
expect(lambdaPermissions[0].Resource).to.deep.eq(lambdaArns);
});
Expand Down

0 comments on commit d224278

Please sign in to comment.