mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[grunt:version] added tests
This commit is contained in:
parent
3e00eb1f5a
commit
d45c1c7900
5 changed files with 41 additions and 8 deletions
|
@ -4,5 +4,5 @@ module.exports = {
|
|||
ignoreLeaks: false,
|
||||
reporter: 'dot'
|
||||
},
|
||||
all: { src: ['<%= root %>/test/server/unit/**/*.js']}
|
||||
all: { src: ['<%= root %>/test/unit/{server,tasks}/**/*.js'] }
|
||||
};
|
||||
|
|
|
@ -17,16 +17,16 @@ var versions = [
|
|||
* "tag" then the new value can be left of and the preivous
|
||||
* value will simply be incremented by one. if the version
|
||||
* peice is tag, some special rules apply:
|
||||
* 1. leaving the value empty will remove a tag
|
||||
* 2. adding a new tag bumps the minor version
|
||||
* 1. leaving the value empty will remove a tag
|
||||
* 2. adding a new tag bumps the minor version
|
||||
*
|
||||
* examples:
|
||||
*
|
||||
* expr: minor
|
||||
* 1.4.1 => 1.5.0
|
||||
* expr: minor
|
||||
* 1.4.1 => 1.5.0
|
||||
*
|
||||
* expr: minor=10
|
||||
* 1.5.5 => 1.10.0
|
||||
* expr: minor=10
|
||||
* 1.5.5 => 1.10.0
|
||||
*
|
||||
* expr: major=4
|
||||
* 0.0.1 => 4.0.0
|
||||
|
@ -122,7 +122,7 @@ function updateVersion(version, expr) {
|
|||
|
||||
// properties that are zero-d by the previous update
|
||||
var emptyUpdates = versions.slice(versions.indexOf(change.name) + 1);
|
||||
while(emptyUpdates.length) {
|
||||
while (emptyUpdates.length) {
|
||||
parts[emptyUpdates.shift()] = '';
|
||||
}
|
||||
})
|
||||
|
|
33
test/unit/tasks/utils/updateVersion.js
Normal file
33
test/unit/tasks/utils/updateVersion.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
var updateVersion = require('../../../../tasks/utils/updateVersion');
|
||||
|
||||
describe('tasks/utils/updateVersion', function () {
|
||||
|
||||
it('applies a basic "minor" update', function () {
|
||||
expect(updateVersion('1.4.1', 'minor')).to.be('1.5.0');
|
||||
});
|
||||
|
||||
it('accepts a number for a version name', function () {
|
||||
expect(updateVersion('1.5.5', 'minor=10')).to.be('1.10.0');
|
||||
});
|
||||
|
||||
it('clears the tag and updates all lower version ids', function () {
|
||||
expect(updateVersion('0.0.1-beta2', 'major=4')).to.be('4.0.0');
|
||||
});
|
||||
|
||||
it('updates just a tag', function () {
|
||||
expect(updateVersion('4.0.0-beta1', 'tag=beta2')).to.be('4.0.0-beta2');
|
||||
});
|
||||
|
||||
it('clears a tag', function () {
|
||||
expect(updateVersion('4.0.0-rc1', 'tag=')).to.be('4.0.0');
|
||||
});
|
||||
|
||||
it('adds a tag, bumping the minor version', function () {
|
||||
expect(updateVersion('4.0.0', 'tag=snapshot')).to.be('4.1.0-snapshot');
|
||||
});
|
||||
|
||||
it('changes a tag', function () {
|
||||
expect(updateVersion('4.1.0-snapshot', 'tag=rc1')).to.be('4.1.0-rc1');
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue