Files
threshold-ui/addons/core/tests/integration/components/session-status-test.js
T
Lisbet Alvarez 3ba93927fe Update copyright headers (#3146)
* empty commit

* Add missing copyright headers

* chore: 🤖 update copywrite config file with correct year

* Add missing copyright headers

* empty commit (gh action merge checks are stuck)
2026-01-28 17:09:06 -08:00

59 lines
2.5 KiB
JavaScript

/**
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
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) {
const store = this.owner.lookup('service:store');
this.model = store.createRecord('session', { status: 'active' });
await render(hbs`<SessionStatus @model={{this.model}} />`);
assert.ok(find('.hds-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) {
const store = this.owner.lookup('service:store');
this.model = store.createRecord('session', { status: 'canceling' });
await render(hbs`<SessionStatus @model={{this.model}} />`);
assert.ok(find('.hds-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) {
const store = this.owner.lookup('service:store');
this.model = store.createRecord('session', { status: 'terminated' });
await render(hbs`<SessionStatus @model={{this.model}} />`);
assert.ok(find('.hds-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) {
const store = this.owner.lookup('service:store');
this.model = store.createRecord('session', { status: 'pending' });
await render(hbs`<SessionStatus @model={{this.model}} />`);
assert.ok(find('.hds-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) {
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('.hds-icon'));
assert.ok(find('.hds-badge--color-neutral'));
assert.ok(find('.hds-badge--type-outlined'));
});
});