forked from sindresorhus/windows-release
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
132 lines (107 loc) · 3.12 KB
/
test.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import test from 'ava';
import windowsRelease from './index.js';
// Test using versions strings sourced from https://www.gaijin.at/en/lstwinver.php
test('Windows 95 versions are correctly matched', t => {
const expected = '95';
const versions = ['4.00.950', '4.00.1111', '4.03.1212', '4.03.1214'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows 98 versions are correctly matched', t => {
const expected = '98';
const versions = ['4.10.1998', '4.10.2222'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows ME versions are correctly matched', t => {
const expected = 'ME';
const versions = ['4.90.2476', '4.90.3000'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows 2000 versions are correctly matched', t => {
const expected = '2000';
const versions = ['5.0.2031', '5.0.2128', '5.0.2183', '5.0.2195'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows XP versions are correctly matched', t => {
const expected = 'XP';
const versions = ['5.1.2505', '5.1.2600', '5.1.2600.1105', '5.1.2600.2180'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows Server 2003 versions are correctly matched', t => {
const expected = 'Server 2003';
const versions = ['5.2.3541', '5.2.3590', '5.2.3660', '5.2.3718', '5.2.3763', '5.2.3790', '5.2.3790.1180', '5.2.3790.1218'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows Vista versions are correctly matched', t => {
const expected = 'Vista';
const versions = [
'6.0.5270',
'6.0.5308',
'6.0.5342',
'6.0.5365',
'6.0.5381',
'6.0.5384',
'6.0.5456',
'6.0.5472',
'6.0.5536',
'6.0.5600.16384',
'6.0.5700',
'6.0.5728',
'6.0.5744.16384',
'6.0.5808',
'6.0.5824',
'6.0.5840',
'6.0.6000.16386',
'6.0.6000',
'6.0.6002',
];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows 7 versions are correctly matched', t => {
const expected = '7';
const versions = ['6.1.7600.16385', '6.1.7600', '6.1.7601'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows 8 versions are correctly matched', t => {
const expected = '8';
const versions = ['6.2.9200', '6.2.10211'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows 8.1 versions are correctly matched', t => {
const expected = '8.1';
const versions = ['6.3.9200', '6.3.9600'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows 10 versions are correctly matched', t => {
const expected = '10';
const versions = ['10.0.10240', '10.0.10586', '10.0.14393'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});
test('Windows 11 versions are correctly matched', t => {
const expected = '11';
const versions = ['10.0.22000', '10.0.23000'];
for (const version of versions) {
t.is(windowsRelease(version), expected);
}
});