文件
mynode/packages/tools/buildServerDocker.test.ts
chen 301194963b
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

43 行
1.2 KiB
TypeScript

import { getIsPreRelease, getVersionFromTag } from './buildServerDocker';
describe('buildServerDocker', () => {
test('should get the tag version', async () => {
type TestCase = [string, boolean, string];
const testCases: TestCase[] = [
['server-v1.2.3-beta', true, '1.2.3-beta'],
['server-v1.2.3-beta', false, '1.2.3'],
['server-v1.2.3', false, '1.2.3'],
['server-v1.2.3-zxc', true, '1.2.3-beta.zxc'],
['server-v1.2.3-zxc', false, '1.2.3'],
['server-v1.2.3-4-zxc', true, '1.2.3-beta.4.zxc'],
['server-v1.2.3-4-zxc', false, '1.2.3'],
['server-1.2.3-4-zxc', true, '1.2.3-beta.4.zxc'],
['server-1.2.3-4-zxc', false, '1.2.3'],
];
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', false], // For now, always returns false
['server-v1.1.2', false],
];
for (const testCase of testCases) {
const [tagName, expected] = testCase;
const actual = getIsPreRelease(tagName);
expect(actual).toBe(expected);
}
});
});