-
-
Notifications
You must be signed in to change notification settings - Fork 437
/
Copy pathinstallable.test.ts
42 lines (40 loc) · 1.21 KB
/
installable.test.ts
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
import { expect } from 'chai';
import { Installable } from '../../common/protocol/installable';
describe('installable', () => {
describe('compare', () => {
const testMe = Installable.Version.COMPARATOR;
(
[
['1.8.1', '1.8.1', 0],
['1.8.1', '1.6.1', 1],
['1.6.1', '1.8.1', -1],
['1.6.1', '1.6.3', -1],
['5.1.1', '5.1.0', 1],
['5.1.0', '5.1.0-beta.1', 1],
['5.1.0-beta.1', '5.1.0', -1],
['5.1.0-beta.2', '5.1.0-beta.1', 1],
['5.1.0-beta.1', '5.1.0-beta.2', -1],
['5.1.0-beta.1', '5.1.1', -1],
['1.1.0', '1.1.0-a', 1],
['1.1.0-a', '1.1.0', -1],
['COM1', 'COM2', -1],
['COM1', 'COM10', -1],
['COM10', 'COM1', 1],
['COM10', 'COM2', 1],
['COM2', 'COM10', -1],
['COM10', 'COM10', 0],
] as Array<[string, string, number]>
).forEach(([left, right, expectation]) => {
it(`'${left}' should be ${
expectation === 0
? 'equal to'
: expectation < 0
? 'less than'
: 'greater than'
} '${right}'`, () => {
const actual = testMe(left, right);
expect(actual).to.be.equal(expectation);
});
});
});
});