From fc3f0b879a98d2f7620d53d80ca796ee9746cd2a Mon Sep 17 00:00:00 2001 From: Alex Casalboni Date: Fri, 22 Sep 2017 17:48:49 -0400 Subject: [PATCH] Fixed uploadArtifacts tests --- .../aws/deploy/lib/uploadArtifacts.test.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/plugins/aws/deploy/lib/uploadArtifacts.test.js b/lib/plugins/aws/deploy/lib/uploadArtifacts.test.js index 951236e6e..3cd4fc67d 100644 --- a/lib/plugins/aws/deploy/lib/uploadArtifacts.test.js +++ b/lib/plugins/aws/deploy/lib/uploadArtifacts.test.js @@ -19,7 +19,7 @@ describe('uploadArtifacts', () => { beforeEach(() => { serverless = new Serverless(); serverless.config.servicePath = 'foo'; - serverless.setProvider('aws', new AwsProvider(serverless)); + serverless.setProvider('aws', new AwsProvider(serverless, {})); const options = { stage: 'dev', region: 'us-east-1', @@ -77,7 +77,18 @@ describe('uploadArtifacts', () => { }); describe('#enableBucketAcceleration()', () => { - it('should enable the S3 bucket transfer acceleration', () => { + it('should NOT enable the S3 bucket transfer acceleration by default', () => { + const putBucketAccelerateConfigurationStub = sinon + .stub(awsDeploy.provider, 'request').resolves(); + + return awsDeploy.enableBucketAcceleration().then(() => { + expect(putBucketAccelerateConfigurationStub.called).to.equal(false); + awsDeploy.provider.request.restore(); + }); + }); + + it('should enable the S3 bucket transfer acceleration, when enabled', () => { + awsDeploy.provider.options['aws-s3-accelerate'] = true; const putBucketAccelerateConfigurationStub = sinon .stub(awsDeploy.provider, 'request').resolves();