()
| 8 | } |
| 9 | |
| 10 | protected tests() { |
| 11 | test("The constructor should throw an error if the parameter does not follow 'int.int.int'", () => { |
| 12 | throws(() => { |
| 13 | let version = new Version("abcd"); |
| 14 | }, Error("version must match 'int.int.int' pattern, but was: abcd")); |
| 15 | |
| 16 | throws(() => { |
| 17 | let version = new Version("3123"); |
| 18 | }, Error("version must match 'int.int.int' pattern, but was: 3123")); |
| 19 | |
| 20 | throws(() => { |
| 21 | let version = new Version("3.1.0."); |
| 22 | }, Error("version must match 'int.int.int' pattern, but was: 3.1.0.")); |
| 23 | |
| 24 | throws(() => { |
| 25 | let version = new Version(".3.1.0"); |
| 26 | }, Error("version must match 'int.int.int' pattern, but was: .3.1.0")); |
| 27 | |
| 28 | throws(() => { |
| 29 | let version = new Version("3..0"); |
| 30 | }, Error("version must match 'int.int.int' pattern, but was: 3..0")); |
| 31 | |
| 32 | throws(() => { |
| 33 | let version = new Version("3.0"); |
| 34 | }, Error("version must match 'int.int.int' pattern, but was: 3.0")); |
| 35 | |
| 36 | throws(() => { |
| 37 | let version = new Version("3.0.a"); |
| 38 | }, Error("version must match 'int.int.int' pattern, but was: 3.0.a")); |
| 39 | |
| 40 | throws(() => { |
| 41 | let version = new Version("3.1.0 "); |
| 42 | }, Error("version must match 'int.int.int' pattern, but was: 3.1.0 ")); |
| 43 | |
| 44 | throws(() => { |
| 45 | let version = new Version(" 3.1.0"); |
| 46 | }, Error("version must match 'int.int.int' pattern, but was: 3.1.0")); |
| 47 | |
| 48 | throws(() => { |
| 49 | let version = new Version(""); |
| 50 | }, Error("version must match 'int.int.int' pattern, but was: ")); |
| 51 | |
| 52 | throws(() => { |
| 53 | let version = new Version(undefined); |
| 54 | }, Error("version must match 'int.int.int' pattern, but was: undefined")); |
| 55 | |
| 56 | /* tslint:disable:no-null-keyword */ |
| 57 | throws(() => { |
| 58 | let version = new Version(null); |
| 59 | }, Error("version must match 'int.int.int' pattern, but was: null")); |
| 60 | /* tslint:enable:no-null-keyword */ |
| 61 | }); |
| 62 | |
| 63 | test("Test comparison methods where both versions are instantiated with the same parameters", () => { |
| 64 | let v1 = new Version("1.2.3"); |
| 65 | let v2 = new Version("1.2.3"); |
| 66 | |
| 67 | ok(v1.isEqualTo(v2)); |
nothing calls this directly
no test coverage detected