serverless/lib/plugins/aws/lib/normalizeFiles.test.js
Philipp Muens 3ad2c5031d Add tests
2017-06-30 13:17:39 +02:00

59 lines
1.3 KiB
JavaScript

'use strict';
const expect = require('chai').expect;
const normalizeFiles = require('./normalizeFiles');
describe('normalizeFiles', () => {
describe('#normalizeCloudFormationTemplate()', () => {
it('should reset the S3 code keys for Lambda functions', () => {
const input = {
Resources: {
MyLambdaFunction: {
Type: 'AWS::Lambda::Function',
Properties: {
Code: {
S3Key: 'some-s3-key-for-the-code',
},
},
},
},
};
const result = normalizeFiles.normalizeCloudFormationTemplate(input);
expect(result).to.deep.equal({
Resources: {
MyLambdaFunction: {
Type: 'AWS::Lambda::Function',
Properties: {
Code: {
S3Key: '',
},
},
},
},
});
});
it('should keep other resources untouched', () => {
const input = {
Resources: {
MyOtherResource: {
Type: 'AWS::XXX::XXX',
},
},
};
const result = normalizeFiles.normalizeCloudFormationTemplate(input);
expect(result).to.deep.equal({
Resources: {
MyOtherResource: {
Type: 'AWS::XXX::XXX',
},
},
});
});
});
});