Updated tests (coverage is OK)

This commit is contained in:
Alex Casalboni 2017-09-21 01:00:46 -04:00
parent 650124cb15
commit cccc77c9bd

View File

@ -52,14 +52,20 @@ describe('uploadArtifacts', () => {
describe('#uploadArtifacts()', () => {
it('should run promise chain in order', () => {
const enableBucketAccelerationStub = sinon
.stub(awsDeploy, 'enableBucketAcceleration').resolves();
const uploadCloudFormationFileStub = sinon
.stub(awsDeploy, 'uploadCloudFormationFile').resolves();
const uploadFunctionsStub = sinon
.stub(awsDeploy, 'uploadFunctions').resolves();
return awsDeploy.uploadArtifacts().then(() => {
expect(enableBucketAccelerationStub.calledOnce)
.to.be.equal(true);
expect(uploadCloudFormationFileStub.calledOnce)
.to.be.equal(true);
expect(uploadCloudFormationFileStub.calledAfter(enableBucketAccelerationStub)).to.be.equal(true);
expect(uploadFunctionsStub.calledAfter(uploadCloudFormationFileStub)).to.be.equal(true);
awsDeploy.uploadCloudFormationFile.restore();
@ -68,6 +74,36 @@ describe('uploadArtifacts', () => {
});
});
describe('#enableBucketAcceleration()', () => {
let putBucketAccelerateConfigurationStub;
beforeEach(() => {
putBucketAccelerateConfigurationStub = sinon
.stub(awsDeploy.provider, 'request')
.resolves();
});
afterEach(() => {
awsDeploy.provider.request.restore();
});
it('should enable the S3 bucket transfer acceleration', () => {
return awsDeploy.enableBucketAcceleration().then(() => {
expect(putBucketAccelerateConfigurationStub.calledOnce).to.equal(true);
expect(putBucketAccelerateConfigurationStub.calledWithExactly(
'S3',
'putBucketAccelerateConfiguration',
{
Bucket: awsDeploy.bucketName,
AccelerateConfiguration: {
Status: 'Enabled'
}
}
)).to.be.equal(true);
});
});
});
describe('#uploadCloudFormationFile()', () => {
let normalizeCloudFormationTemplateStub;
let uploadStub;