5c2a08de6d
* Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
115 lines
4.5 KiB
JavaScript
115 lines
4.5 KiB
JavaScript
import { addMinutes } from 'date-fns';
|
|
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render } from '@ember/test-helpers';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import { create } from 'ember-cli-page-object';
|
|
import license from '../../pages/components/license-info';
|
|
import { allFeatures } from 'vault/helpers/all-features';
|
|
|
|
const FEATURES = allFeatures();
|
|
|
|
const component = create(license);
|
|
|
|
module('Integration | Component | license info', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test('it renders feature status properly for features associated with license', async function (assert) {
|
|
const now = Date.now();
|
|
this.set('licenseId', 'temporary');
|
|
this.set('expirationTime', addMinutes(now, 30));
|
|
this.set('startTime', now);
|
|
this.set('features', ['HSM', 'Namespaces']);
|
|
await render(
|
|
hbs`<LicenseInfo @licenseId={{this.licenseId}} @expirationTime={{this.expirationTime}} @startTime={{this.startTime}} @features={{this.features}}/>`
|
|
);
|
|
assert.equal(component.detailRows.length, 3, 'Shows License ID, Valid from, and License State rows');
|
|
assert.equal(component.featureRows.length, FEATURES.length, 'it renders all of the features');
|
|
let activeFeatures = component.featureRows.filter((f) => f.featureStatus === 'Active');
|
|
assert.equal(activeFeatures.length, 2, 'Has two features listed as active');
|
|
});
|
|
|
|
test('it renders properly for autoloaded license', async function (assert) {
|
|
const now = Date.now();
|
|
this.set('licenseId', 'test');
|
|
this.set('expirationTime', addMinutes(now, 30));
|
|
this.set('autoloaded', true);
|
|
this.set('startTime', now);
|
|
this.set('features', ['HSM', 'Namespaces']);
|
|
await render(
|
|
hbs`<LicenseInfo
|
|
@licenseId={{this.licenseId}}
|
|
@expirationTime={{this.expirationTime}}
|
|
@startTime={{this.startTime}}
|
|
@features={{this.features}}
|
|
@autoloaded={{true}}
|
|
/>`
|
|
);
|
|
let row = component.detailRows.filterBy('rowName', 'License state')[0];
|
|
assert.equal(row.rowValue, 'Autoloaded', 'Shows autoloaded status');
|
|
});
|
|
|
|
test('it renders properly for stored license', async function (assert) {
|
|
const now = Date.now();
|
|
this.set('licenseId', 'test');
|
|
this.set('expirationTime', addMinutes(now, 30));
|
|
this.set('autoloaded', false);
|
|
this.set('startTime', now);
|
|
this.set('features', ['HSM', 'Namespaces']);
|
|
await render(
|
|
hbs`<LicenseInfo
|
|
@licenseId={{this.licenseId}}
|
|
@expirationTime={{this.expirationTime}}
|
|
@startTime={{this.startTime}}
|
|
@features={{this.features}}
|
|
@autoloaded={{false}}
|
|
/>`
|
|
);
|
|
let row = component.detailRows.filterBy('rowName', 'License state')[0];
|
|
assert.ok(
|
|
row.rowValue.includes(
|
|
'Stored licenses will be deprecated in a future version of Vault. We recommend autoloading your license.'
|
|
),
|
|
'Stored license includes recommendation to autoload'
|
|
);
|
|
});
|
|
|
|
test('it renders Performance Standby as inactive if count is 0', async function (assert) {
|
|
const now = Date.now();
|
|
this.set('licenseId', 'temporary');
|
|
this.set('expirationTime', addMinutes(now, 30));
|
|
this.set('startTime', now);
|
|
this.set('model', { performanceStandbyCount: 0 });
|
|
this.set('features', ['Performance Standby', 'Namespaces']);
|
|
|
|
await render(
|
|
hbs`<LicenseInfo @licenseId={{this.licenseId}} @expirationTime={{this.expirationTime}} @startTime={{this.startTime}} @features={{this.features}} @model={{this.model}}/>`
|
|
);
|
|
|
|
let row = component.featureRows.filterBy('featureName', 'Performance Standby')[0];
|
|
assert.equal(row.featureStatus, 'Not Active', 'renders feature as inactive because when count is 0');
|
|
});
|
|
|
|
test('it renders Performance Standby as active and shows count', async function (assert) {
|
|
const now = Date.now();
|
|
this.set('licenseId', 'temporary');
|
|
this.set('expirationTime', addMinutes(now, 30));
|
|
this.set('startTime', now);
|
|
this.set('model', { performanceStandbyCount: 4 });
|
|
this.set('features', ['Performance Standby', 'Namespaces']);
|
|
|
|
await render(
|
|
hbs`<LicenseInfo
|
|
@licenseId={{this.licenseId}}
|
|
@expirationTime={{this.expirationTime}}
|
|
@startTime={{this.startTime}}
|
|
@features={{this.features}}
|
|
@performanceStandbyCount={{this.model.performanceStandbyCount}}
|
|
/>`
|
|
);
|
|
|
|
let row = component.featureRows.filterBy('featureName', 'Performance Standby')[0];
|
|
assert.equal(row.featureStatus, 'Active — 4 standby nodes allotted', 'renders active and displays count');
|
|
});
|
|
});
|