Fix the tests to use the updated log group reference

TODO: verify the loggroup resource addition
This commit is contained in:
Erik Erikson 2016-09-15 11:52:26 -07:00
parent b8134cb15e
commit 596bb0eb98

View File

@ -129,6 +129,7 @@ describe('AwsCompileFunctions', () => {
});
it('should update IamPolicyLambdaExecution with a logging resource for the function', () => {
const normalizedName = `${functionName[0].toUpperCase()}${functionName.substr(1)}LogGroup`;
awsCompileFunctions.compileFunctions();
expect(awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate
@ -140,17 +141,7 @@ describe('AwsCompileFunctions', () => {
.Resource
).to.deep.equal(
[
{
'Fn:Join': [
':',
[
'arn:aws:logs',
{ Ref: 'AWS::Region' },
{ Ref: 'AWS::AccountId' },
`log-group:/aws/lambda/${functionName}*:*:*`,
],
],
},
{ 'Fn:Join': [':', [{ 'Fn::GetAtt': [normalizedName, 'Arn'] }, '*', '*']] },
]
);
});
@ -167,6 +158,11 @@ describe('AwsCompileFunctions', () => {
name: 'func1',
},
};
const f = service.functions;
const normalizedNames = [
`${f.func0.name[0].toUpperCase()}${f.func0.name.substr(1)}LogGroup`,
`${f.func1.name[0].toUpperCase()}${f.func1.name.substr(1)}LogGroup`,
];
awsCompileFunctions.compileFunctions();
expect(awsCompileFunctions.serverless.service.provider.compiledCloudFormationTemplate
@ -178,28 +174,8 @@ describe('AwsCompileFunctions', () => {
.Resource
).to.deep.equal(
[
{
'Fn:Join': [
':',
[
'arn:aws:logs',
{ Ref: 'AWS::Region' },
{ Ref: 'AWS::AccountId' },
`log-group:/aws/lambda/${service.functions.func0.name}*:*:*`,
],
],
},
{
'Fn:Join': [
':',
[
'arn:aws:logs',
{ Ref: 'AWS::Region' },
{ Ref: 'AWS::AccountId' },
`log-group:/aws/lambda/${service.functions.func1.name}*:*:*`,
],
],
},
{ 'Fn:Join': [':', [{ 'Fn::GetAtt': [normalizedNames[0], 'Arn'] }, '*', '*']] },
{ 'Fn:Join': [':', [{ 'Fn::GetAtt': [normalizedNames[1], 'Arn'] }, '*', '*']] },
]
);
});