-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathversion.spec.js
94 lines (87 loc) · 1.58 KB
/
version.spec.js
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import natsort from '../../src'
describe('version number strings: ', () => {
it('close version numbers', () => {
expect([
'1.0.2',
'1.0.1',
'1.0.0',
'1.0.9'
].sort(natsort())).toEqual([
'1.0.0',
'1.0.1',
'1.0.2',
'1.0.9'
]);
});
it('#6', () => {
expect([
'1.10.0',
'1.9.0',
'1.11.0',
].sort(natsort())).toEqual([
'1.9.0',
'1.10.0',
'1.11.0',
]);
});
it('more version numbers', () => {
expect([
'1.1.100',
'1.1.1',
'1.1.10',
'1.1.54'
].sort(natsort())).toEqual([
'1.1.1',
'1.1.10',
'1.1.54',
'1.1.100'
]);
});
it('multi-digit branch release', () => {
expect([
'1.0.03',
'1.0.003',
'1.0.002',
'1.0.0001'
].sort(natsort())).toEqual([
'1.0.0001',
'1.0.002',
'1.0.003',
'1.0.03'
]);
});
it('string last', () => {
expect([
'1.1beta',
'1.1.2alpha3',
'1.0.2alpha3',
'1.0.2alpha1',
'1.0.1alpha4',
'2.1.2',
'2.1.1'
].sort(natsort())).toEqual([
'1.0.1alpha4',
'1.0.2alpha1',
'1.0.2alpha3',
'1.1.2alpha3',
'1.1beta',
'2.1.1',
'2.1.2'
]);
});
it('string first', () => {
expect([
'myRelease-1.1.3',
'myRelease-1.2.3',
'myRelease-1.1.4',
'myRelease-1.1.1',
'myRelease-1.0.5'
].sort(natsort())).toEqual([
'myRelease-1.0.5',
'myRelease-1.1.1',
'myRelease-1.1.3',
'myRelease-1.1.4',
'myRelease-1.2.3'
]);
});
});