mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
Updated tests (coverage is OK)
This commit is contained in:
parent
650124cb15
commit
cccc77c9bd
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user