Vault Automation b057aac746
[VAULT-43339] 1/2 Chore update TS (#13050) (#13105)
* Initial ts updgrade

* Migrate linked-block to ts to squash ts errors

* [VAULT-43339] 2/2 Update vault-reporting and add ember-intl (#13062)

* Update vault-reporting and add ember-intl

* Add setupIntl for rendering tests

Co-authored-by: Jim Wright <jim.wright@hashicorp.com>
2026-03-17 15:52:40 -07:00

45 lines
1.7 KiB
JavaScript

/**
* Copyright IBM Corp. 2016, 2025
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupRenderingTest } from 'vault/tests/helpers';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { GENERAL } from 'vault/tests/helpers/general-selectors';
import AuthMethodResource from 'vault/resources/auth/method';
module('Integration | Component | auth-method/configuration', function (hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function () {
this.store = this.owner.lookup('service:store');
this.createMethod = (path, type) => {
this.method = new AuthMethodResource({ path, type, config: { listing_visibility: 'hidden' } }, this);
};
this.renderComponent = () => render(hbs`<AuthMethod::Configuration @method={{this.method}} />`);
});
test('it renders direct link for supported method', async function (assert) {
this.createMethod('token/', 'token');
await this.renderComponent();
assert.dom(GENERAL.infoRowValue('UI login link')).hasText(`${window.origin}/ui/vault/auth?with=token%2F`);
});
test('it does not render direct link for unsupported method', async function (assert) {
this.createMethod('my-approle/', 'approle');
await this.renderComponent();
assert.dom(GENERAL.infoRowValue('UI login link')).doesNotExist();
});
test('it renders direct link if within a namespace', async function (assert) {
this.owner.lookup('service:namespace').set('path', 'foo/bar');
this.createMethod('token/', 'token');
await this.renderComponent();
assert
.dom(GENERAL.infoRowValue('UI login link'))
.hasText(`${window.origin}/ui/vault/auth?namespace=foo%2Fbar&with=token%2F`);
});
});