open-vault/ui/tests/integration/helpers/changelog-url-for-test.js

40 lines
1.3 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { changelogUrlFor } from '../../../helpers/changelog-url-for';
const CHANGELOG_URL = 'https://www.github.com/hashicorp/vault/blob/main/CHANGELOG.md#';
module('Integration | Helper | changelog-url-for', function (hooks) {
setupRenderingTest(hooks);
test('it builds an enterprise URL', function (assert) {
const result = changelogUrlFor(['1.5.0+prem']);
assert.strictEqual(result, CHANGELOG_URL.concat('150'));
});
test('it builds an OSS URL', function (assert) {
const result = changelogUrlFor(['1.4.3']);
assert.strictEqual(result, CHANGELOG_URL.concat('143'));
});
test('it returns the base changelog URL if the version is less than 1.4.3', function (assert) {
const result = changelogUrlFor(['1.4.0']);
assert.strictEqual(result, CHANGELOG_URL);
});
test('it returns the base changelog URL if version cannot be found', function (assert) {
const result = changelogUrlFor(['']);
assert.strictEqual(result, CHANGELOG_URL);
});
test('it builds the url for double-digit versions', function (assert) {
const result = changelogUrlFor(['1.13.0+ent']);
assert.strictEqual(result, CHANGELOG_URL.concat('1130'));
});
});