Skip to content

Commit d224278

Browse files
test: add test case for Fn::Sub
1 parent 6c202f9 commit d224278

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/deploy/stepFunctions/compileIamRole.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,11 +1230,20 @@ describe('#compileIamRole', () => {
12301230
// function name can be...
12311231
const lambda1 = { Ref: 'MyFunction' }; // name
12321232
const lambda2 = { 'Fn::GetAtt': ['MyFunction', 'Arn'] }; // Arn
1233+
const lambda3 = { // or, something we don't need special handling for
1234+
'Fn::Sub': [
1235+
'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${FunctionName}',
1236+
{
1237+
FunctionName: 'myFunction',
1238+
},
1239+
],
1240+
};
12331241

12341242
serverless.service.stepFunctions = {
12351243
stateMachines: {
12361244
myStateMachine1: getStateMachine('sm1', lambda1),
12371245
myStateMachine2: getStateMachine('sm2', lambda2),
1246+
myStateMachine3: getStateMachine('sm3', lambda3),
12381247
},
12391248
};
12401249

@@ -1260,6 +1269,14 @@ describe('#compileIamRole', () => {
12601269
'Arn',
12611270
],
12621271
},
1272+
{
1273+
'Fn::Sub': [
1274+
'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${FunctionName}',
1275+
{
1276+
FunctionName: 'myFunction',
1277+
},
1278+
],
1279+
},
12631280
];
12641281
expect(lambdaPermissions[0].Resource).to.deep.eq(lambdaArns);
12651282
});

0 commit comments

Comments
 (0)