Skip to content

Commit

Permalink
test(package): fix coverage for lib/package.js
Browse files Browse the repository at this point in the history
  • Loading branch information
tvardy committed Jun 5, 2017
1 parent fc31e9a commit 006a2a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions lib/package.js
Expand Up @@ -49,6 +49,7 @@ exports.extractRepoUrl = function () {
* @returns {Promise<String>} - new version
*/
exports.calculateNewVersion = function (options) {
options = options || {};
return exports.getUserPackage()
.then(function (userPackage) {
var split = userPackage.version.split('.');
Expand Down
18 changes: 12 additions & 6 deletions test/package.test.js
Expand Up @@ -114,12 +114,12 @@ describe('package', function () {
Package.getUserPackage.restore();
});

it('bumps the patch version if patch is true', function () {
var options = { patch: true };
it('bumps the major version if major is true', function () {
var options = { major: true };

return Package.calculateNewVersion(options)
.then(function (version) {
Expect(version).to.eql('1.2.4');
Expect(version).to.eql('2.0.0');
});
});

Expand All @@ -132,15 +132,21 @@ describe('package', function () {
});
});

it('bumps the major version if major is true', function () {
var options = { major: true };
it('bumps the patch version if patch is true', function () {
var options = { patch: true };

return Package.calculateNewVersion(options)
.then(function (version) {
Expect(version).to.eql('2.0.0');
Expect(version).to.eql('1.2.4');
});
});

it('leaves the version untouched if none of three options is true', function () {
return Package.calculateNewVersion()
.then(function (version) {
Expect(version).to.eql('1.2.3');
});
});
});

});

0 comments on commit 006a2a0

Please sign in to comment.