More tests to increase coverage

This commit is contained in:
Frank Schmid 2017-10-26 12:14:10 +02:00
parent 97896eb34f
commit 06cf6df2e6

View File

@ -1,6 +1,6 @@
'use strict';
const expect = require('chai').expect;
const chai = require('chai');
const sinon = require('sinon');
const path = require('path');
const fs = require('fs');
@ -9,6 +9,11 @@ const AwsProvider = require('../provider/awsProvider');
const Serverless = require('../../../Serverless');
const testUtils = require('../../../../tests/utils');
chai.use(require('chai-as-promised'));
chai.use(require('sinon-chai'));
const expect = chai.expect;
describe('AwsDeployFunction', () => {
let AwsDeployFunction;
let serverless;
@ -292,7 +297,14 @@ describe('AwsDeployFunction', () => {
options.functionObj = {
name: 'first',
description: 'change',
vpc: undefined,
vpc: {
securityGroupIds: ['xxxxx', {
ref: 'myVPCRef',
}],
subnetIds: ['xxxxx', {
ref: 'myVPCRef',
}],
},
environment: {
myvar: 'this is my var',
myref: {
@ -318,6 +330,23 @@ describe('AwsDeployFunction', () => {
});
});
it('should do nothing if only references are in', () => {
options.functionObj = {
name: 'first',
environment: {
myvar: 'this is my var',
myref: {
ref: 'aCFReference',
},
},
};
awsDeployFunction.options = options;
return expect(awsDeployFunction.updateFunctionConfiguration()).to.be.fulfilled
.then(() => expect(updateFunctionConfigurationStub).to.not.be.called);
});
it('should fail when using invalid characters in environment variable', () => {
options.functionObj = {
name: 'first',