diff --git a/lib/plugins/aws/deploy/lib/uploadArtifacts.test.js b/lib/plugins/aws/deploy/lib/uploadArtifacts.test.js index 7af45d186..6cd354370 100644 --- a/lib/plugins/aws/deploy/lib/uploadArtifacts.test.js +++ b/lib/plugins/aws/deploy/lib/uploadArtifacts.test.js @@ -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;