-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathtryParseFuncVersion.test.ts
74 lines (60 loc) · 2.35 KB
/
tryParseFuncVersion.test.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
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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { FuncVersion, tryParseFuncVersion } from '../extension.bundle';
suite('tryParseFuncVersion', () => {
const specificOne: string = '1.0.0';
test(specificOne, () => {
assert.equal(tryParseFuncVersion(specificOne), FuncVersion.v1);
});
const genericOne: string = '~1';
test(genericOne, () => {
assert.equal(tryParseFuncVersion(genericOne), FuncVersion.v1);
});
const specificTwo: string = '2.0.0';
test(specificTwo, () => {
assert.equal(tryParseFuncVersion(specificTwo), FuncVersion.v2);
});
const versionInCsprojFile: string = 'v2';
test(versionInCsprojFile, () => {
assert.equal(tryParseFuncVersion(versionInCsprojFile), FuncVersion.v2);
});
const genericTwo: string = '~2';
test(genericTwo, () => {
assert.equal(tryParseFuncVersion(genericTwo), FuncVersion.v2);
});
const specificThree: string = '3.0.0';
test(specificThree, () => {
assert.equal(tryParseFuncVersion(specificThree), FuncVersion.v3);
});
const prerelease: string = '3.0.0-alpha';
test(prerelease, () => {
assert.equal(tryParseFuncVersion(prerelease), FuncVersion.v3);
});
const genericThree: string = '~3';
test(genericThree, () => {
assert.equal(tryParseFuncVersion(genericThree), FuncVersion.v3);
});
const four: string = '~4';
test(four, () => {
assert.equal(tryParseFuncVersion(four), FuncVersion.v4);
});
const specific99: string = '99.0.0';
test(specific99, () => {
assert.equal(tryParseFuncVersion(specific99), undefined);
});
const generic99: string = '~99';
test(generic99, () => {
assert.equal(tryParseFuncVersion(generic99), undefined);
});
const beta: string = 'beta';
test(beta, () => {
assert.equal(tryParseFuncVersion(beta), undefined);
});
const latest: string = 'latest';
test(latest, () => {
assert.equal(tryParseFuncVersion(latest), undefined);
});
});