Files
threshold-ui/ui/desktop/tests/integration/components/credentials-panel-test.js
T
Cameron PereraandDharini Jeeva d5d2045fb5 Icu 10315 add credentials panel (#1855)
* feat: 🎸 add credentials panel for session detail screen

✅ Closes: ICU-10315

* fix: 🐛 remove use of A in sessions list array

* refactor: 💡 fix class name to apply style to both detail screen

* refactor: 💡 add comment to resetController on session route

* refactor: 💡 add @value to HDS Toggle in session detail page

* refactor: 💡 class name refactor for credential panel

* refactor: 💡 remove unneeded div around CodeEditor

* refactor: 💡 change border units from rem to px

* feat: 🎸 create CredentialsPanel component

* Update ui/desktop/tests/integration/components/credentials-panel-test.js

Co-authored-by: Dharini Jeeva <dharini@hashicorp.com>

* refactor: 💡 update credential panel styles

* style: 💄 fix lint error for desktop styles

* chore: 🤖 yarn.lock update

---------

Co-authored-by: Dharini Jeeva <dharini@hashicorp.com>
2023-09-22 18:58:13 -04:00

66 lines
1.6 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { module, test } from 'qunit';
import { setupRenderingTest } from 'desktop/tests/helpers';
import { render, click } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupIntl } from 'ember-intl/test-support';
module('Integration | Component | credentials-panel', function (hooks) {
setupRenderingTest(hooks);
setupIntl(hooks);
const credential = {
rawCredential: {
credential_source: {
id: 'clvlt_4cvscMTl0N',
name: 'Credential Library 1',
description: 'Source Description',
credential_store_id: 'csvlt_Q1HFGt7Jpm',
type: 'vault',
},
secret: {
raw: 'anVzdC1hLXJhbmRvbS1zdHJpbmc=',
},
},
source: {
id: 'clvlt_4cvscMTl0N',
name: 'Credential Library 1',
description: 'Source Description',
type: 'vault',
},
secrets: [
{
key: 'secret',
value: 'just-a-random-string',
},
],
};
test('it renders', async function (assert) {
assert.expect(1);
this.set('credentials', [credential]);
await render(hbs`
<CredentialsPanel @credentials={{this.credentials}} />
`);
assert.dom('.credential-name').hasText('Credential Library 1');
});
test('it shows code editor when toggle clicked', async function (assert) {
assert.expect(1);
this.set('credentials', [credential]);
await render(hbs`
<CredentialsPanel @credentials={{this.credentials}} />
`);
await click('[data-test-toggle-credentials]');
assert.dom('.raw-secret').isVisible();
});
});