2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2020-06-15 21:53:48 +00:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
|
|
import { changelogUrlFor } from '../../../helpers/changelog-url-for';
|
|
|
|
|
2021-10-07 17:38:12 +00:00
|
|
|
const CHANGELOG_URL = 'https://www.github.com/hashicorp/vault/blob/main/CHANGELOG.md#';
|
2020-06-15 21:53:48 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
module('Integration | Helper | changelog-url-for', function (hooks) {
|
2020-06-15 21:53:48 +00:00
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it builds an enterprise URL', function (assert) {
|
2020-06-15 21:53:48 +00:00
|
|
|
const result = changelogUrlFor(['1.5.0+prem']);
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(result, CHANGELOG_URL.concat('150'));
|
2020-06-15 21:53:48 +00:00
|
|
|
});
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it builds an OSS URL', function (assert) {
|
2020-06-15 21:53:48 +00:00
|
|
|
const result = changelogUrlFor(['1.4.3']);
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(result, CHANGELOG_URL.concat('143'));
|
2020-06-15 21:53:48 +00:00
|
|
|
});
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it returns the base changelog URL if the version is less than 1.4.3', function (assert) {
|
2020-06-15 21:53:48 +00:00
|
|
|
const result = changelogUrlFor(['1.4.0']);
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(result, CHANGELOG_URL);
|
2020-06-15 21:53:48 +00:00
|
|
|
});
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it returns the base changelog URL if version cannot be found', function (assert) {
|
2020-06-15 21:53:48 +00:00
|
|
|
const result = changelogUrlFor(['']);
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(result, CHANGELOG_URL);
|
2020-06-15 21:53:48 +00:00
|
|
|
});
|
|
|
|
});
|