-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathversion.test.js
54 lines (53 loc) · 1.32 KB
/
version.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
const parser = require("./main");
describe("Test versions", function () {
it("unserialize a version string", function () {
const test = parser.create({
parser: {
version: "7.3",
},
});
expect(test.parser.version).toEqual(703);
});
it("unserialize a version string - with bugfix ignored", function () {
const test = parser.create({
parser: {
version: "7.3.5",
},
});
expect(test.parser.version).toEqual(703);
});
it("fail to parse array", function () {
expect(
parser.create.bind(null, {
parser: {
version: [701],
},
}),
).toThrow(new Error("Expecting a number for version"));
});
it("fail to parse bad version numbers", function () {
expect(
parser.create.bind(null, {
parser: {
version: "x.y.z",
},
}),
).toThrow(new Error("Bad version number : x.y.z"));
});
it("unhandled version", function () {
expect(
parser.create.bind(null, {
parser: {
version: "4.9",
},
}),
).toThrow(new Error("Can only handle versions between 5.x to 8.x"));
expect(
parser.create.bind(null, {
parser: {
version: "9.9",
},
}),
).toThrow(new Error("Can only handle versions between 5.x to 8.x"));
});
});