Icu 14781 add a section for server information (#2438)

This commit is contained in:
Dharini Jeeva authored and Zhihe Li committed 2024-09-24 11:58:25 -04:00
1 parent 63ec418cf0
commit de5defeab2
9 files changed
+136 -3

No files matched your search

@@ -0,0 +1,40 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupIntl } from 'ember-intl/test-support';
const SERVER_NAME = '[data-test-server-name]';
const SERVER_URL = '[data-test-server-url]';
module('Integration | Component | settings-card/server', function (hooks) {
setupRenderingTest(hooks);
setupIntl(hooks);
const setDefaultClusterUrl = (test) => {
const windowOrigin = 'hashicorp.cloud';
const clusterUrl = test.owner.lookup('service:clusterUrl');
clusterUrl.rendererClusterUrl = windowOrigin;
};
setDefaultClusterUrl(this);
test('it displays HCP cluster url in server information section', async function (assert) {
await render(hbs`<SettingsCard::Server/>`);
assert.dom(SERVER_NAME).hasText('HashiCorp Cloud Platform');
assert.dom(SERVER_URL).hasText('hashicorp.cloud');
});
test('it displays non HCP cluster url in server information section', async function (assert) {
this.owner.lookup('service:clusterUrl').rendererClusterUrl =
'everythingelse';
await render(hbs`<SettingsCard::Server/>`);
assert.dom(SERVER_NAME).hasText('Self-Managed');
assert.dom(SERVER_URL).hasText('everythingelse');
});
});