vault/ui/tests/unit/services/version-test.js
Vault Automation a92bffe5ce
UI: Hide Client Count Dashboard for PKI Only Clusters (#10513) (#10831)
* hide client counting dashboard for PKI only clusters

* add test and hide client count card

* convert to ts,
add pki only license banner, add comments, and support for multiple dismissed types

* add banner description

* add changelog entry

* update tests + add test coverage for multiple banners + info banner

* update tests

* add doc link

* Apply suggestions from code review



* naming updates

* update feature key format

* update casing

* add enum, revert naming, move helper to util

* test hidden nav link and dashboard card

---------

Co-authored-by: lane-wetmore <lane.wetmore@hashicorp.com>
Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
2025-11-17 09:11:14 -06:00

84 lines
2.9 KiB
JavaScript

/**
* Copyright IBM Corp. 2016, 2025
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Service | version', function (hooks) {
setupTest(hooks);
test('setting type computes isCommunity properly', function (assert) {
const service = this.owner.lookup('service:version');
service.type = 'community';
assert.true(service.isCommunity);
assert.false(service.isEnterprise);
});
test('setting type computes isEnterprise properly', function (assert) {
const service = this.owner.lookup('service:version');
service.type = 'enterprise';
assert.false(service.isCommunity);
assert.true(service.isEnterprise);
});
test('calculates versionDisplay correctly', function (assert) {
const service = this.owner.lookup('service:version');
service.type = 'community';
service.version = '1.2.3';
assert.strictEqual(service.versionDisplay, 'v1.2.3');
service.type = 'enterprise';
service.version = '1.4.7+ent';
assert.strictEqual(service.versionDisplay, 'v1.4.7');
});
test('hasPerfReplication', function (assert) {
const service = this.owner.lookup('service:version');
assert.false(service.hasPerfReplication);
service.features = ['Performance Replication'];
assert.true(service.hasPerfReplication);
});
test('hasDRReplication', function (assert) {
const service = this.owner.lookup('service:version');
assert.false(service.hasDRReplication);
service.features = ['DR Replication'];
assert.true(service.hasDRReplication);
});
test('hasPKIOnly', function (assert) {
const service = this.owner.lookup('service:version');
assert.false(service.hasPKIOnly);
service.features = ['PKI-only Secrets'];
assert.true(service.hasPKIOnly);
});
// SHOW SECRETS SYNC TESTS
test('hasSecretsSync: it returns false when version is community', function (assert) {
const service = this.owner.lookup('service:version');
service.type = 'community';
assert.false(service.hasSecretsSync);
});
test('hasSecretsSync: it returns true when HVD managed', function (assert) {
this.owner.lookup('service:flags').featureFlags = ['VAULT_CLOUD_ADMIN_NAMESPACE'];
const service = this.owner.lookup('service:version');
service.type = 'enterprise';
assert.true(service.hasSecretsSync);
});
test('hasSecretsSync: it returns false when not on enterprise license', function (assert) {
const service = this.owner.lookup('service:version');
service.type = 'enterprise';
service.features = ['replication'];
assert.false(service.hasSecretsSync);
});
test('hasSecretsSync: it returns true when on enterprise license', function (assert) {
const service = this.owner.lookup('service:version');
service.type = 'enterprise';
service.features = ['secrets-sync'];
assert.false(service.hasSecretsSync);
});
});