forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server_version.test.jsx
66 lines (55 loc) · 2.6 KB
/
server_version.test.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {equalServerVersions} from 'utils/server_version.jsx';
describe('utils/server_version/equalServerVersions', () => {
test('should handle undefined values', () => {
const a = undefined; // eslint-disable-line no-undefined
const b = null;
expect(equalServerVersions(a, b)).toEqual(true);
});
test('should consider two empty versions as equal', () => {
const a = '';
const b = '';
expect(equalServerVersions(a, b)).toEqual(true);
});
test('should consider different strings without components as equal', () => {
const a = 'not a server version';
const b = 'also not a server version';
expect(equalServerVersions(a, b)).toEqual(true);
});
test('should consider different malformed versions as equal ignoring the last two components', () => {
const a = '1.2.3';
const b = '1.2.4';
expect(equalServerVersions(a, b)).toEqual(true);
});
test('should consider an empty version different from a non-empty one', () => {
const a = '';
const b = '4.7.1.dev.c51676437bc02ada78f3a0a0a2203c60.true';
expect(equalServerVersions(a, b)).toEqual(false);
});
test('should consider the same versions equal', () => {
const a = '4.7.1.dev.c51676437bc02ada78f3a0a0a2203c60.true';
const b = '4.7.1.dev.c51676437bc02ada78f3a0a0a2203c60.true';
expect(equalServerVersions(a, b)).toEqual(true);
});
test('should consider different release versions unequal', () => {
const a = '4.7.0.12.c51676437bc02ada78f3a0a0a2203c60.true';
const b = '4.7.1.12.c51676437bc02ada78f3a0a0a2203c60.true';
expect(equalServerVersions(a, b)).toEqual(false);
});
test('should consider different build numbers unequal', () => {
const a = '4.7.1.12.c51676437bc02ada78f3a0a0a2203c60.true';
const b = '4.7.1.13.c51676437bc02ada78f3a0a0a2203c60.true';
expect(equalServerVersions(a, b)).toEqual(false);
});
test('should ignore different config hashes', () => {
const a = '4.7.1.12.c51676437bc02ada78f3a0a0a2203c60.true';
const b = '4.7.1.12.c51676437bc02ada78f3a0a0a2203c61.true';
expect(equalServerVersions(a, b)).toEqual(true);
});
test('should ignore different licensed statuses', () => {
const a = '4.7.1.12.c51676437bc02ada78f3a0a0a2203c60.false';
const b = '4.7.1.12.c51676437bc02ada78f3a0a0a2203c60.true';
expect(equalServerVersions(a, b)).toEqual(true);
});
});