fix more overspecified tests

This commit is contained in:
John McKim 2016-08-25 06:59:19 +10:00
parent d1f6d90d14
commit 4b3267eb13

View File

@ -104,6 +104,7 @@ describe('#packageService()', () => {
expect(isMatch).to.equal(true);
});
});
describe('#packageService()', () => {
it('should resolve if the user has specified his own artifact', () => {
const artifactFilePath = 'artifact.zip';
@ -112,7 +113,7 @@ describe('#packageService()', () => {
const packageAllStub = sinon
.stub(packageService, 'packageAll').returns(BbPromise.resolve());
packageService.packageService().then(() => {
return packageService.packageService().then(() => {
expect(packageAllStub.called).to.be.equal(false);
// ensure it's not changed
expect(serverless.service.package.artifact).to.equal(artifactFilePath);
@ -151,19 +152,18 @@ describe('#packageService()', () => {
});
});
it('should package functions all', (done) => {
it('should package functions all', () => {
serverless.service.package.individually = false;
const packageAllStub = sinon
.stub(packageService, 'packageAll').returns(BbPromise.resolve());
packageService.packageService().then(() => {
return packageService.packageService().then(() => {
expect(packageAllStub.calledOnce).to.be.equal(true);
done();
});
});
it('should package functions individually', (done) => {
it('should package functions individually', () => {
serverless.service.package.individually = true;
serverless.service.functions = {
'test-one': {
@ -177,16 +177,15 @@ describe('#packageService()', () => {
const packageFunctionStub = sinon
.stub(packageService, 'packageFunction').returns((func) => BbPromise.resolve(func.name));
packageService.packageService().then(() => {
return packageService.packageService().then(() => {
// TODO: check how many times it was called
expect(packageFunctionStub.called).to.be.equal(true);
done();
});
});
});
describe('#packageFunction()', () => {
it('should call zipService with settings', (done) => {
it('should call zipService with settings', () => {
const servicePath = 'test';
const funcName = 'test-func';
@ -217,8 +216,6 @@ describe('#packageService()', () => {
expect(zipDirectoryStub.calledOnce).to.be.equal(true);
expect(filePath).to.be.equal(artifactFilePath);
done();
});
});
});