2021-09-23 17:48:26 +02:00
|
|
|
import { getIsPreRelease, getVersionFromTag } from './buildServerDocker';
|
|
|
|
|
2023-02-20 17:02:29 +02:00
|
|
|
describe('buildServerDocker', () => {
|
2021-09-23 17:48:26 +02:00
|
|
|
|
|
|
|
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],
|
2021-10-01 19:45:07 +02:00
|
|
|
['server-v1.1.2', true], // For now, always returns true
|
2021-09-23 17:48:26 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
for (const testCase of testCases) {
|
|
|
|
const [tagName, expected] = testCase;
|
|
|
|
const actual = getIsPreRelease(tagName);
|
|
|
|
expect(actual).toBe(expected);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|