diff --git a/lib/package.js b/lib/package.js index b8395a6..89fdd08 100644 --- a/lib/package.js +++ b/lib/package.js @@ -49,6 +49,7 @@ exports.extractRepoUrl = function () { * @returns {Promise} - new version */ exports.calculateNewVersion = function (options) { + options = options || {}; return exports.getUserPackage() .then(function (userPackage) { var split = userPackage.version.split('.'); diff --git a/test/package.test.js b/test/package.test.js index 713314a..c8937e9 100644 --- a/test/package.test.js +++ b/test/package.test.js @@ -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'); }); }); @@ -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'); + }); + }); }); });