2023-10-12 08:37:56 +07:00
|
|
|
import * as assert from 'assert/strict';
|
|
|
|
import {linkToGitHubReleases} from '../../../src/utils/linkToGithubReleases';
|
|
|
|
|
|
|
|
describe('linkToGithubRelease', function () {
|
2024-09-16 09:46:19 +02:00
|
|
|
it('handles empty version', function () {
|
|
|
|
const link = linkToGitHubReleases('');
|
|
|
|
assert.equal(link, '');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('handles plain version release', function () {
|
|
|
|
const link = linkToGitHubReleases('5.69.0');
|
2023-10-12 08:37:56 +07:00
|
|
|
assert.equal(link, 'https://github.com/TryGhost/Ghost/releases/tag/v5.69.0');
|
|
|
|
});
|
|
|
|
|
2024-09-16 09:46:19 +02:00
|
|
|
it('handles plain version with +moya suffix', function () {
|
|
|
|
const link = linkToGitHubReleases('5.69.0+moya');
|
2023-10-12 08:37:56 +07:00
|
|
|
assert.equal(link, 'https://github.com/TryGhost/Ghost/releases/tag/v5.69.0');
|
|
|
|
});
|
2024-09-16 09:46:19 +02:00
|
|
|
|
|
|
|
it('handles git describe output', function () {
|
|
|
|
const link = linkToGitHubReleases('5.69.0-0-gabcdef');
|
|
|
|
assert.equal(link, 'https://github.com/TryGhost/Ghost/commit/abcdef');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('handles git describe output with +moya suffix', function () {
|
|
|
|
const link = linkToGitHubReleases('5.69.0-0-gabcdef+moya');
|
|
|
|
assert.equal(link, 'https://github.com/TryGhost/Ghost/commit/abcdef');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('handles prerelease version', function () {
|
|
|
|
const link = linkToGitHubReleases('5.70.0-pre-gabcdef+moya');
|
|
|
|
assert.equal(link, 'https://github.com/TryGhost/Ghost/commit/abcdef');
|
|
|
|
});
|
2023-10-12 08:37:56 +07:00
|
|
|
});
|