0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/apps/admin-x-settings/test/unit/utils/linkToGithubReleases.test.ts
Daniel Lockyer c29dc48370 Updated version handling in Admin-X Settings
fix https://linear.app/tryghost/issue/DEV-22/add-support-to-admin-for-parsing-ghost-git-version

- we need to be handle the output given by `git describe`, to account
  for upcoming changes to our versioning
- this commit allows Admin-X Settings to parse these strings, and adds
  tests to check for this
2024-09-16 09:57:09 +02:00

34 lines
1.3 KiB
TypeScript

import * as assert from 'assert/strict';
import {linkToGitHubReleases} from '../../../src/utils/linkToGithubReleases';
describe('linkToGithubRelease', function () {
it('handles empty version', function () {
const link = linkToGitHubReleases('');
assert.equal(link, '');
});
it('handles plain version release', function () {
const link = linkToGitHubReleases('5.69.0');
assert.equal(link, 'https://github.com/TryGhost/Ghost/releases/tag/v5.69.0');
});
it('handles plain version with +moya suffix', function () {
const link = linkToGitHubReleases('5.69.0+moya');
assert.equal(link, 'https://github.com/TryGhost/Ghost/releases/tag/v5.69.0');
});
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');
});
});