forked from gTile/gTile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shellversion.spec.ts
36 lines (35 loc) · 1.96 KB
/
shellversion.spec.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
import { ShellVersion } from "./shellversion";
describe("shellversion", () => {
it("parsing of major and minor version to work for valid versions", () => {
expect(ShellVersion.parse('3.34').major).toEqual(3);
expect(ShellVersion.parse('3.34').minor).toEqual(34)
expect(ShellVersion.parse('3.3').minor).toEqual(3);
});
it("parsing of major and minor version to treat bad minor version as zero", () => {
expect(ShellVersion.parse('3.4x').major).toEqual(3);
expect(ShellVersion.parse('3.4x').minor).toEqual(0);
});
it("parsing of major and minor version to fail for invalid major version", () => {
expect(() => ShellVersion.parse('3x.33').major).toThrow();
});
it("https://github.com/gTile/gTile/issues/187 is fixed", () => {
expect(ShellVersion.parse('40.alpha.1').major).toEqual(40);
expect(ShellVersion.parse('40.alpha.1').minor).toEqual(0);
});
it("version_at_least_34 to behave properly", () => {
expect(ShellVersion.parse('3.34').version_at_least_34()).toBeTrue();
expect(ShellVersion.parse('3.35').version_at_least_34()).toBeTrue();
expect(ShellVersion.parse('4.35').version_at_least_34()).toBeTrue();
expect(ShellVersion.parse('2.35').version_at_least_34()).toBeFalse();
expect(ShellVersion.parse('3.33').version_at_least_34()).toBeFalse();
});
it("version_at_least_36 to behave properly", () => {
expect(ShellVersion.parse('3.34').version_at_least_36()).toBeFalse();
expect(ShellVersion.parse('3.35').version_at_least_36()).toBeFalse();
expect(ShellVersion.parse('3.36').version_at_least_36()).toBeTrue();
expect(ShellVersion.parse('3.37').version_at_least_36()).toBeTrue();
expect(ShellVersion.parse('4.35').version_at_least_36()).toBeTrue();
expect(ShellVersion.parse('2.35').version_at_least_36()).toBeFalse();
expect(ShellVersion.parse('3.33').version_at_least_36()).toBeFalse();
});
})