15872cc2d4
* Unknown status for allocations accounted for * Canary string removed * Test cleanup * Generate unknown in mirage * aacidentally oovervoowled * Update ui/app/components/allocation-status-bar.js Co-authored-by: Derek Strickland <1111455+DerekStrickland@users.noreply.github.com> * Disconnected state on job status in client * Renaming Disconnected to Unknown in the job-status-in-client * Unknown accounted for on job rows filtering and testsfix * Adding lostAllocs as a computed dependency * Unknown client status within acceptance test * Swatches updated and PR comments addressed * Unknown and disconnected added to test fixtures Co-authored-by: Derek Strickland <1111455+DerekStrickland@users.noreply.github.com>
85 lines
2.3 KiB
JavaScript
85 lines
2.3 KiB
JavaScript
import { module, test } from 'qunit';
|
|
import { create } from 'ember-cli-page-object';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render } from '@ember/test-helpers';
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
import sinon from 'sinon';
|
|
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
|
import jobClientStatusBar from 'nomad-ui/tests/pages/components/job-client-status-bar';
|
|
|
|
const JobClientStatusBar = create(jobClientStatusBar());
|
|
|
|
module('Integration | Component | job-client-status-bar', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
const commonProperties = () => ({
|
|
onSliceClick: sinon.spy(),
|
|
job: {
|
|
namespace: {
|
|
get: () => 'my-namespace',
|
|
},
|
|
},
|
|
jobClientStatus: {
|
|
byStatus: {
|
|
queued: [],
|
|
starting: ['someNodeId'],
|
|
running: [],
|
|
complete: [],
|
|
degraded: [],
|
|
failed: [],
|
|
lost: [],
|
|
notScheduled: [],
|
|
unknown: [],
|
|
},
|
|
},
|
|
isNarrow: true,
|
|
});
|
|
|
|
const commonTemplate = hbs`
|
|
<JobClientStatusBar
|
|
@onSliceClick={{onSliceClick}}
|
|
@job={{job}}
|
|
@jobClientStatus={{jobClientStatus}}
|
|
@isNarrow={{isNarrow}}
|
|
/>`;
|
|
|
|
test('it renders', async function (assert) {
|
|
assert.expect(2);
|
|
|
|
const props = commonProperties();
|
|
this.setProperties(props);
|
|
await render(commonTemplate);
|
|
|
|
assert.ok(JobClientStatusBar.isPresent, 'Client Status Bar is rendered');
|
|
await componentA11yAudit(this.element, assert);
|
|
});
|
|
|
|
test('it fires the onBarClick handler method when clicking a bar in the chart', async function (assert) {
|
|
const props = commonProperties();
|
|
this.setProperties(props);
|
|
await render(commonTemplate);
|
|
await JobClientStatusBar.slices[0].click();
|
|
assert.ok(props.onSliceClick.calledOnce);
|
|
});
|
|
|
|
test('it handles an update to client status property', async function (assert) {
|
|
const props = commonProperties();
|
|
this.setProperties(props);
|
|
await render(commonTemplate);
|
|
const newProps = {
|
|
...props,
|
|
jobClientStatus: {
|
|
...props.jobClientStatus,
|
|
byStatus: {
|
|
...props.jobClientStatus.byStatus,
|
|
starting: [],
|
|
running: ['someNodeId'],
|
|
},
|
|
},
|
|
};
|
|
this.setProperties(newProps);
|
|
await JobClientStatusBar.visitSlice('running');
|
|
assert.ok(props.onSliceClick.calledOnce);
|
|
});
|
|
});
|