Add tests

This commit is contained in:
Philipp Muens 2017-07-19 10:39:54 +02:00
parent ec9538127d
commit 9ffde98f28
2 changed files with 33 additions and 0 deletions

View File

@ -147,5 +147,20 @@ describe('Platform', () => {
expect(console.log.calledWithExactly(url)).to.be.equal(true);
});
});
it('should skip publishing if user opted out via "publish" config', () => {
platform.serverless.service.service = 'new-service-2';
platform.serverless.service.serviceObject = {
name: 'new-service-2',
publish: false,
};
return platform.publishService().then(() => {
expect(getAuthTokenStub.calledOnce).to.be.equal(true);
expect(getAccountIdStub.calledOnce).to.be.equal(false);
expect(endpointsRequestStub.calledOnce).to.be.equal(false);
expect(publishServiceRequestStub.calledOnce).to.be.equal(false);
});
});
});
});

View File

@ -0,0 +1,18 @@
'use strict';
const expect = require('chai').expect;
const selectServicePublish = require('./selectServicePublish');
describe('#selectServicePublish()', () => {
it('should return the publish value of the service object', () => {
const service = {
serviceObject: {
publish: true,
},
};
const result = selectServicePublish(service);
expect(result).to.equal(true);
});
});