-
-
Notifications
You must be signed in to change notification settings - Fork 5k
/
buildServerDocker.test.ts
35 lines (27 loc) · 933 Bytes
/
buildServerDocker.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
import { getIsPreRelease, getVersionFromTag } from './buildServerDocker';
describe('buildServerDocker', () => {
test('should get the tag version', async () => {
type TestCase = [string, boolean, string];
const testCases: TestCase[] = [
['server-v1.1.2-beta', true, '1.1.2-beta'],
['server-v1.1.2', false, '1.1.2'],
];
for (const testCase of testCases) {
const [tagName, isPreRelease, expected] = testCase;
const actual = getVersionFromTag(tagName, isPreRelease);
expect(actual).toBe(expected);
}
});
test('should check if it is a pre-release', async () => {
type TestCase = [string, boolean];
const testCases: TestCase[] = [
['server-v1.1.2-beta', true],
['server-v1.1.2', true], // For now, always returns true
];
for (const testCase of testCases) {
const [tagName, expected] = testCase;
const actual = getIsPreRelease(tagName);
expect(actual).toBe(expected);
}
});
});