mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2026-01-10 14:11:40 +00:00
* first round, there shall be more * fix secret test * more clean up * maybe last round of clean up? * this is going to take a while * all the things or more of them at least * this is the song that never ends... * ... it goes on and on my friend. * clean up clean up everybody lets clean up * rename mount helper to mountBackend * clean up 🧹 * address pr comments --------- Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { click, currentURL } from '@ember/test-helpers';
|
|
import { GENERAL } from 'vault/tests/helpers/general-selectors';
|
|
import { MOUNT_BACKEND_FORM } from 'vault/tests/helpers/components/mount-backend-form-selectors';
|
|
import { mountBackend } from 'vault/tests/helpers/components/mount-backend-form-helpers';
|
|
|
|
const assertFields = (assert, fields, customSelectors = {}) => {
|
|
fields.forEach((param) => {
|
|
if (Object.keys(customSelectors).includes(param)) {
|
|
assert.dom(customSelectors[param]).exists();
|
|
} else {
|
|
assert.dom(GENERAL.inputByAttr(param)).exists();
|
|
}
|
|
});
|
|
};
|
|
export default (test) => {
|
|
test('it renders mount fields', async function (assert) {
|
|
await click(MOUNT_BACKEND_FORM.mountType(this.type));
|
|
await click(GENERAL.toggleGroup('Method Options'));
|
|
assertFields(assert, this.mountFields, this.customSelectors);
|
|
});
|
|
|
|
test('it renders tune fields', async function (assert) {
|
|
// enable auth method to check tune fields
|
|
await mountBackend(this.type, this.path);
|
|
assert.strictEqual(
|
|
currentURL(),
|
|
`/vault/settings/auth/configure/${this.path}/configuration`,
|
|
`${this.type}: it mounts navigates to tune form`
|
|
);
|
|
|
|
assertFields(assert, this.tuneFields, this.customSelectors);
|
|
|
|
for (const toggle in this.tuneToggles) {
|
|
const fields = this.tuneToggles[toggle];
|
|
await click(GENERAL.toggleGroup(toggle));
|
|
assertFields(assert, fields, this.customSelectors);
|
|
}
|
|
});
|
|
};
|