mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
Improve semver unit test
Now handles empty database scenario
This commit is contained in:
parent
c31711c130
commit
8077dd939a
4 changed files with 675 additions and 668 deletions
File diff suppressed because one or more lines are too long
|
@ -177,7 +177,6 @@ export default BaseService.extend({
|
|||
membership: [],
|
||||
summary: []
|
||||
};
|
||||
if (is.not.array(response)) response = [];
|
||||
|
||||
let cats = response.category.map((obj) => {
|
||||
let data = this.get('store').normalize('category', obj);
|
||||
|
|
|
@ -71,6 +71,9 @@ function isNewVersion(v1, v2, compareRevision) {
|
|||
v1 = v1.trim().toLowerCase();
|
||||
v2 = v2.trim().toLowerCase();
|
||||
|
||||
// Handle edge case of no prior version.
|
||||
if (v1 === '' && v2 !== '') return true;
|
||||
|
||||
// Format expected is "1.2.3".
|
||||
let v1parts = v1.split('.');
|
||||
let v2parts = v2.split('.');
|
||||
|
|
|
@ -21,6 +21,11 @@ module('Unit | Utility | Version', function (hooks) {
|
|||
assert.equal(result, false, 'version cleaned and same');
|
||||
});
|
||||
|
||||
test('version migration', function (assert) {
|
||||
let result = misc.isNewVersion('', 'v1.0.0', false);
|
||||
assert.equal(result, true, 'version migration');
|
||||
});
|
||||
|
||||
test('version same', function (assert) {
|
||||
let result = misc.isNewVersion('v1.0.0', 'v1.0.0', false);
|
||||
assert.equal(result, false, 'version same');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue