Files
threshold-ui/addons/core/tests/integration/components/session-status-test.js
T
Devon Anderson 9e7852f18d chore: 🤖 Upgrade addons/core to Ember 4.12.2 (#1965)
* chore: 🤖 Upgrade `addons/core` to Ember 4.12.2

Upgrade `addons/core` to Ember 4.12.2

✅ Closes: ICU-11341

* refactor: 💡 testing updating plugin-proposal-decorators version

Update `@babel/plugin-proposal-decorators` to latest version.

* refactor: 💡 testing legacy plugin-proposa-decorators version

Testin `legacy` version for `plugin-proposal-decorators` plugin

* refactor: 💡 testing plugin-proposal-decorators

Testing `@babel/plugin-proposal-decorators`

* refactor: 💡 Revert @babel/exlint-parser to previous version

Revert `@babel/eslint-parser` to use version 2018 EcmaScript version
until further research is done on latest versions

* Update package.json

put @babel/core back into `devDependencies`

* refactor: 💡 testing linging changes

Pushed ember-tempalate-lint, prettier, and ember template lint plugin
for prettier to latest versions to test why CI builds are not passing.

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-11341
2023-10-27 11:10:30 -04:00

63 lines
2.6 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | session-status', function (hooks) {
setupRenderingTest(hooks);
test('it maps to correct text color, icon and type if it is in active status', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
this.model = store.createRecord('session', { status: 'active' });
await render(hbs`<SessionStatus @model={{this.model}} />`);
assert.ok(find('.flight-icon-check'));
assert.ok(find('.hds-badge--color-success'));
assert.ok(find('.hds-badge--type-filled'));
});
test('it maps to correct text color, icon and type if it is in canceling status', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
this.model = store.createRecord('session', { status: 'canceling' });
await render(hbs`<SessionStatus @model={{this.model}} />`);
assert.ok(find('.flight-icon-alert-triangle'));
assert.ok(find('.hds-badge--color-warning'));
assert.ok(find('.hds-badge--type-filled'));
});
test('it maps to correct text color, icon and type if it is in terminated status', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
this.model = store.createRecord('session', { status: 'terminated' });
await render(hbs`<SessionStatus @model={{this.model}} />`);
assert.ok(find('.flight-icon-x'));
assert.ok(find('.hds-badge--color-critical'));
assert.ok(find('.hds-badge--type-filled'));
});
test('it maps to correct text color, icon and type if it is in pending status', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
this.model = store.createRecord('session', { status: 'pending' });
await render(hbs`<SessionStatus @model={{this.model}} />`);
assert.ok(find('.flight-icon-delay'));
assert.ok(find('.hds-badge--color-neutral'));
assert.ok(find('.hds-badge--type-filled'));
});
test('display neutral color and outlined style when it is an unknown status', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
this.model = store.createRecord('session', { status: 'any string' });
await render(hbs`<SessionStatus @model={{this.model}} />`);
assert.notOk(find('.flight-icon'));
assert.ok(find('.hds-badge--color-neutral'));
assert.ok(find('.hds-badge--type-outlined'));
});
});