mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 09:25:46 +03:00
ui: apply new qunit linting rules to tests
Async tests should use in integrations tests. Acceptance tests are using Mirage and can't use since we can't know the number of assertions.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
/* Mirage fixtures are random so we can't expect a set number of assertions */
|
||||
import { run } from '@ember/runloop';
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { assign } from '@ember/polyfills';
|
||||
@@ -207,6 +209,7 @@ module('Acceptance | allocation detail', function(hooks) {
|
||||
|
||||
await Allocation.tasks.objectAt(0).clickLink();
|
||||
|
||||
// Make sure the allocation is pending in order to ensure there are no tasks
|
||||
assert.equal(
|
||||
currentURL(),
|
||||
`/allocations/${allocation.id}/${task.name}`,
|
||||
|
||||
@@ -18,6 +18,8 @@ module('Acceptance | application errors ', function (hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
server.pretender.get('/v1/nodes', () => [500, {}, null]);
|
||||
await ClientsList.visit();
|
||||
await a11yAudit(assert);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { test } from 'qunit';
|
||||
import { currentURL, visit } from '@ember/test-helpers';
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
/* eslint-disable qunit/no-conditional-assertions */
|
||||
/* Mirage fixtures are random so we can't expect a set number of assertions */
|
||||
import { currentURL, waitUntil, settled } from '@ember/test-helpers';
|
||||
import { assign } from '@ember/polyfills';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL, settled } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { module, skip, test } from 'qunit';
|
||||
import { currentURL, settled } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
@@ -75,11 +76,13 @@ module('Acceptance | job clients', function (hooks) {
|
||||
|
||||
['createTime', 'modifyTime'].forEach((col) => {
|
||||
if (jobStatus === 'not scheduled') {
|
||||
/* eslint-disable-next-line qunit/no-conditional-assertions */
|
||||
assert.equal(
|
||||
clientRow[col].text,
|
||||
'-',
|
||||
`row ${index} doesn't have ${col} tooltip`
|
||||
);
|
||||
/* eslint-disable-next-line qunit/no-early-return */
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ module('Acceptance | job definition', function (hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
await a11yAudit(assert, 'scrollable-region-focusable');
|
||||
});
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ module('Acceptance | job deployments', function (hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
await Deployments.visit({ id: job.id });
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
@@ -48,7 +50,7 @@ module('Acceptance | job deployments', function (hooks) {
|
||||
test('/jobs/:id/deployments should list all job deployments', async function (assert) {
|
||||
await Deployments.visit({ id: job.id });
|
||||
|
||||
assert.ok(
|
||||
assert.equal(
|
||||
Deployments.deployments.length,
|
||||
deployments.length,
|
||||
'Each deployment gets a row in the timeline'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* eslint-disable ember/no-test-module-for */
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/* eslint-disable ember/no-test-module-for */
|
||||
/* eslint-disable qunit/require-expect */
|
||||
/* eslint-disable qunit/no-conditional-assertions */
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
import { setupMirage } from 'ember-cli-mirage/test-support';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -56,6 +56,8 @@ module('Acceptance | job run', function (hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
await JobRun.visit();
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
/* eslint-disable qunit/no-conditional-assertions */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
@@ -36,7 +38,7 @@ module('Acceptance | job versions', function (hooks) {
|
||||
});
|
||||
|
||||
test('/jobs/:id/versions should list all job versions', async function (assert) {
|
||||
assert.ok(
|
||||
assert.equal(
|
||||
Versions.versions.length,
|
||||
versions.length,
|
||||
'Each version gets a row in the timeline'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
/* eslint-disable qunit/no-conditional-assertions */
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
import { currentURL, visit } from '@ember/test-helpers';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { module, test } from 'qunit';
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { module, test } from 'qunit';
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
/* eslint-disable qunit/no-conditional-assertions */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* eslint-disable ember-a11y-testing/a11y-audit-called */ // TODO
|
||||
/* eslint-disable ember-a11y-testing/a11y-audit-called */
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { module, test } from 'qunit';
|
||||
import { currentURL, triggerEvent, visit } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
@@ -114,7 +115,7 @@ module('Acceptance | search', function (hooks) {
|
||||
request.requestBody.includes('feature-detection-query')
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
assert.equal(
|
||||
featureDetectionQueries.length,
|
||||
1,
|
||||
'expect the feature detection query to only run once'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -27,6 +27,8 @@ module('Acceptance | server monitor', function (hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
await ServerMonitor.visit({ name: agent.name });
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
/* eslint-disable qunit/no-conditional-assertions */
|
||||
import { currentURL, settled } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { run } from '@ember/runloop';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
@@ -30,6 +30,8 @@ module('Acceptance | tokens', function (hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
await Tokens.visit();
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
@@ -25,6 +25,8 @@ module('Acceptance | topology', function (hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
server.createList('node', 3);
|
||||
server.createList('allocation', 5);
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { module, test } from 'qunit';
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
import { currentURL, visit } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
// Used in glimmer component unit tests. Glimmer components should typically
|
||||
// be tested with integration tests, but occasionally individual methods or
|
||||
// properties have logic that isn't coupled to rendering or the DOM and can
|
||||
// be better tested in a unit fashion.
|
||||
//
|
||||
// Use like
|
||||
//
|
||||
// setupGlimmerComponentFactory(hooks, 'my-component')
|
||||
//
|
||||
// test('testing my component', function(assert) {
|
||||
// const component = this.createComponent({ hello: 'world' });
|
||||
// assert.equal(component.args.hello, 'world');
|
||||
// });
|
||||
/* eslint-disable qunit/no-commented-tests */
|
||||
// We comment test to show an example of how to use the factory function
|
||||
|
||||
/*
|
||||
Used in glimmer component unit tests. Glimmer components should typically
|
||||
be tested with integration tests, but occasionally individual methods or
|
||||
properties have logic that isn't coupled to rendering or the DOM and can
|
||||
be better tested in a unit fashion.
|
||||
|
||||
Use like
|
||||
|
||||
setupGlimmerComponentFactory(hooks, 'my-component')
|
||||
|
||||
test('testing my component', function(assert) {
|
||||
const component = this.createComponent({ hello: 'world' });
|
||||
assert.equal(component.args.hello, 'world');
|
||||
});
|
||||
*/
|
||||
|
||||
export default function setupGlimmerComponentFactory(hooks, componentKey) {
|
||||
hooks.beforeEach(function () {
|
||||
this.createComponent = glimmerComponentInstantiator(
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable qunit/require-expect */
|
||||
/* eslint-disable qunit/no-conditional-assertions */
|
||||
import { currentURL } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
|
||||
@@ -52,6 +52,8 @@ module('Integration | Component | agent-monitor', function (hooks) {
|
||||
`;
|
||||
|
||||
test('basic appearance', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
this.setProperties({
|
||||
level: 'info',
|
||||
client: { id: 'client1' },
|
||||
|
||||
@@ -35,7 +35,7 @@ module('Integration | Component | allocation row', function(hooks) {
|
||||
JSON.stringify({ ResourceUsage: generateResources() }),
|
||||
null,
|
||||
'<Not>Valid JSON</Not>',
|
||||
JSON.stringify({ ResourceUsage: generateResources() }),
|
||||
JSON.stringify({ ResourceUsage: generateResources() })
|
||||
];
|
||||
|
||||
this.server.get('/client/allocation/:id/stats', function() {
|
||||
@@ -60,7 +60,7 @@ module('Integration | Component | allocation row', function(hooks) {
|
||||
this.setProperties({
|
||||
allocation,
|
||||
context: 'job',
|
||||
enablePolling: true,
|
||||
enablePolling: true
|
||||
});
|
||||
|
||||
await render(hbs`
|
||||
@@ -87,9 +87,9 @@ module('Integration | Component | allocation row', function(hooks) {
|
||||
name: 'node-read',
|
||||
rulesJSON: {
|
||||
Node: {
|
||||
Policy: 'read',
|
||||
},
|
||||
},
|
||||
Policy: 'read'
|
||||
}
|
||||
}
|
||||
});
|
||||
const clientToken = server.create('token', { type: 'client' });
|
||||
clientToken.policyIds = [policy.id];
|
||||
@@ -116,7 +116,7 @@ module('Integration | Component | allocation row', function(hooks) {
|
||||
|
||||
this.setProperties({
|
||||
allocation,
|
||||
context: 'job',
|
||||
context: 'job'
|
||||
});
|
||||
|
||||
await render(hbs`
|
||||
@@ -150,7 +150,7 @@ module('Integration | Component | allocation row', function(hooks) {
|
||||
test('when an allocation is not running, the utilization graphs are omitted', async function(assert) {
|
||||
this.setProperties({
|
||||
context: 'job',
|
||||
enablePolling: false,
|
||||
enablePolling: false
|
||||
});
|
||||
|
||||
// All non-running statuses need to be tested
|
||||
|
||||
@@ -11,7 +11,7 @@ module('Integration | Component | app breadcrumbs', function(hooks) {
|
||||
|
||||
const commonCrumbs = [
|
||||
{ label: 'Jobs', args: ['jobs.index'] },
|
||||
{ label: 'Job', args: ['jobs.job.index'] },
|
||||
{ label: 'Job', args: ['jobs.job.index'] }
|
||||
];
|
||||
|
||||
test('every breadcrumb is rendered correctly', async function(assert) {
|
||||
@@ -25,7 +25,9 @@ module('Integration | Component | app breadcrumbs', function(hooks) {
|
||||
|
||||
assert
|
||||
.dom('[data-test-breadcrumb-default]')
|
||||
.exists('We register the default breadcrumb component if no type is specified on the crumb');
|
||||
.exists(
|
||||
'We register the default breadcrumb component if no type is specified on the crumb'
|
||||
);
|
||||
|
||||
const renderedCrumbs = findAll('[data-test-breadcrumb]');
|
||||
|
||||
@@ -41,7 +43,7 @@ module('Integration | Component | app breadcrumbs', function(hooks) {
|
||||
test('when we register a crumb with a type property, a dedicated breadcrumb/<type> component renders', async function(assert) {
|
||||
const crumbs = [
|
||||
{ label: 'Jobs', args: ['jobs.index'] },
|
||||
{ type: 'special', label: 'Job', args: ['jobs.job.index'] },
|
||||
{ type: 'special', label: 'Job', args: ['jobs.job.index'] }
|
||||
];
|
||||
this.set('crumbs', crumbs);
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ module('Integration | Component | attributes table', function (hooks) {
|
||||
};
|
||||
|
||||
test('should render a row for each key/value pair in a deep object', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
this.set('attributes', commonAttributes);
|
||||
await render(hbs`<AttributesTable @attributePairs={{attributes}} />`);
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ module('Integration | Component | copy-button', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it shows the copy icon by default', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
await render(hbs`<CopyButton @class="copy-button" />`);
|
||||
|
||||
assert.dom('.copy-button .icon-is-copy-action').exists();
|
||||
@@ -22,6 +24,8 @@ module('Integration | Component | copy-button', function (hooks) {
|
||||
});
|
||||
|
||||
test('it shows the success icon on success and resets afterward', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const clock = sinon.useFakeTimers({ shouldAdvanceTime: true });
|
||||
|
||||
await render(hbs`<CopyButton @class="copy-button" />`);
|
||||
@@ -41,6 +45,8 @@ module('Integration | Component | copy-button', function (hooks) {
|
||||
});
|
||||
|
||||
test('it shows the error icon on error', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
await render(hbs`<CopyButton @class="copy-button" />`);
|
||||
|
||||
await click('.copy-button button');
|
||||
|
||||
@@ -13,6 +13,8 @@ module('Integration | Component | das/dismissed', function (hooks) {
|
||||
});
|
||||
|
||||
test('it renders the dismissal interstitial with a button to proceed and an option to never show again and proceeds manually', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const proceedSpy = sinon.spy();
|
||||
this.set('proceedSpy', proceedSpy);
|
||||
|
||||
@@ -31,6 +33,8 @@ module('Integration | Component | das/dismissed', function (hooks) {
|
||||
});
|
||||
|
||||
test('it renders the dismissal interstitial with no button when the option to never show again has been chosen and proceeds automatically', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
window.localStorage.setItem('nomadRecommendationDismssalUnderstood', true);
|
||||
|
||||
const proceedSpy = sinon.spy();
|
||||
|
||||
@@ -31,6 +31,8 @@ module('Integration | Component | das/recommendation-card', function (hooks) {
|
||||
});
|
||||
|
||||
test('it renders a recommendation card', async function (assert) {
|
||||
assert.expect(49);
|
||||
|
||||
const task1 = {
|
||||
name: 'jortle',
|
||||
reservedCPU: 150,
|
||||
|
||||
@@ -8,6 +8,8 @@ module('Integration | Component | das/recommendation-chart', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders a chart for a recommended CPU increase', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
this.set('resource', 'CPU');
|
||||
this.set('current', 1312);
|
||||
this.set('recommended', 1919);
|
||||
@@ -30,6 +32,8 @@ module('Integration | Component | das/recommendation-chart', function (hooks) {
|
||||
});
|
||||
|
||||
test('it renders a chart for a recommended memory decrease', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
this.set('resource', 'MemoryMB');
|
||||
this.set('current', 1919);
|
||||
this.set('recommended', 1312);
|
||||
@@ -75,6 +79,8 @@ module('Integration | Component | das/recommendation-chart', function (hooks) {
|
||||
});
|
||||
|
||||
test('it can be disabled and will show no delta', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
this.set('resource', 'CPU');
|
||||
this.set('current', 1312);
|
||||
this.set('recommended', 1919);
|
||||
|
||||
@@ -12,6 +12,8 @@ module('Integration | Component | FlexMasonry', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('presents as a single div when @items is empty', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
this.setProperties({
|
||||
items: [],
|
||||
});
|
||||
@@ -96,6 +98,8 @@ module('Integration | Component | FlexMasonry', function (hooks) {
|
||||
});
|
||||
|
||||
test('items are rendered to the DOM in the order they were passed into the component', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
this.setProperties({
|
||||
items: [
|
||||
{ text: 'One', height: h(20) },
|
||||
@@ -120,6 +124,8 @@ module('Integration | Component | FlexMasonry', function (hooks) {
|
||||
});
|
||||
|
||||
test('each item gets an order property', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
this.setProperties({
|
||||
items: [
|
||||
{ text: 'One', height: h(20), expectedOrder: 0 },
|
||||
@@ -144,6 +150,8 @@ module('Integration | Component | FlexMasonry', function (hooks) {
|
||||
});
|
||||
|
||||
test('the last item in each column gets a specific flex-basis value', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
this.setProperties({
|
||||
items: [
|
||||
{ text: 'One', height: h(20) },
|
||||
@@ -166,12 +174,15 @@ module('Integration | Component | FlexMasonry', function (hooks) {
|
||||
|
||||
findAll('[data-test-flex-masonry-item]').forEach((el, index) => {
|
||||
if (el.style.flexBasis) {
|
||||
/* eslint-disable-next-line qunit/no-conditional-assertions */
|
||||
assert.equal(el.style.flexBasis, this.items[index].flexBasis);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test('when a multi-column layout becomes a single column layout, all inline-styles are reset', async function (assert) {
|
||||
assert.expect(14);
|
||||
|
||||
this.setProperties({
|
||||
items: [
|
||||
{ text: 'One', height: h(20) },
|
||||
|
||||
@@ -77,6 +77,8 @@ module('Integration | Component | fs/file', function (hooks) {
|
||||
);
|
||||
|
||||
test('When a file is text-based, the file mode is streaming', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const props = makeProps(fileStat('text/plain', 500));
|
||||
this.setProperties(props);
|
||||
|
||||
@@ -95,6 +97,8 @@ module('Integration | Component | fs/file', function (hooks) {
|
||||
});
|
||||
|
||||
test('When a file is an image, the file mode is image', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const props = makeProps(fileStat('image/png', 1234));
|
||||
this.setProperties(props);
|
||||
|
||||
@@ -113,6 +117,8 @@ module('Integration | Component | fs/file', function (hooks) {
|
||||
});
|
||||
|
||||
test('When the file is neither text-based or an image, the unsupported file type empty state is shown', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const props = makeProps(fileStat('wat/ohno', 1234));
|
||||
this.setProperties(props);
|
||||
|
||||
@@ -228,6 +234,8 @@ module('Integration | Component | fs/file', function (hooks) {
|
||||
});
|
||||
|
||||
test('Yielded content goes in the top-left header area', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
const props = makeProps(fileStat('image/svg', 5000));
|
||||
this.setProperties(props);
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ module('Integration | Component | gauge chart', function (hooks) {
|
||||
});
|
||||
|
||||
test('presents as an svg, a formatted percentage, and a label', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ module('Integration | Component | image file', function (hooks) {
|
||||
};
|
||||
|
||||
test('component displays the image', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.setProperties(commonProperties);
|
||||
|
||||
await render(commonTemplate);
|
||||
|
||||
@@ -43,6 +43,8 @@ module('Integration | Component | job-client-status-bar', function (hooks) {
|
||||
/>`;
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
|
||||
@@ -17,6 +17,8 @@ module('Integration | Component | job diff', function (hooks) {
|
||||
`;
|
||||
|
||||
test('job field diffs', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
this.set('diff', {
|
||||
ID: 'test-case-1',
|
||||
Type: 'Edited',
|
||||
@@ -67,6 +69,8 @@ module('Integration | Component | job diff', function (hooks) {
|
||||
});
|
||||
|
||||
test('job object diffs', async function (assert) {
|
||||
assert.expect(9);
|
||||
|
||||
this.set('diff', {
|
||||
ID: 'test-case-2',
|
||||
Type: 'Edited',
|
||||
|
||||
@@ -110,6 +110,8 @@ module('Integration | Component | job-editor', function (hooks) {
|
||||
};
|
||||
|
||||
test('the default state is an editor with an explanation popup', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const job = await this.store.createRecord('job');
|
||||
|
||||
await renderNewJob(this, job);
|
||||
@@ -190,6 +192,8 @@ module('Integration | Component | job-editor', function (hooks) {
|
||||
});
|
||||
|
||||
test('when a job is successfully parsed and planned, the plan is shown to the user', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const spec = hclJob();
|
||||
const job = await this.store.createRecord('job');
|
||||
|
||||
@@ -221,6 +225,8 @@ module('Integration | Component | job-editor', function (hooks) {
|
||||
});
|
||||
|
||||
test('when parse fails, the parse error message is shown', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
const spec = hclJob();
|
||||
const errorMessage = 'Parse Failed!! :o';
|
||||
const job = await this.store.createRecord('job');
|
||||
@@ -243,6 +249,8 @@ module('Integration | Component | job-editor', function (hooks) {
|
||||
});
|
||||
|
||||
test('when plan fails, the plan error message is shown', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
const spec = hclJob();
|
||||
const errorMessage = 'Plan Failed!! :o';
|
||||
const job = await this.store.createRecord('job');
|
||||
@@ -269,6 +277,8 @@ module('Integration | Component | job-editor', function (hooks) {
|
||||
});
|
||||
|
||||
test('when run fails, the run error message is shown', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
const spec = hclJob();
|
||||
const errorMessage = 'Run Failed!! :o';
|
||||
const job = await this.store.createRecord('job');
|
||||
@@ -292,6 +302,8 @@ module('Integration | Component | job-editor', function (hooks) {
|
||||
});
|
||||
|
||||
test('when the scheduler dry-run has warnings, the warnings are shown to the user', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const spec = jsonJob({ Unschedulable: true });
|
||||
const job = await this.store.createRecord('job');
|
||||
|
||||
@@ -314,6 +326,8 @@ module('Integration | Component | job-editor', function (hooks) {
|
||||
});
|
||||
|
||||
test('when the scheduler dry-run has no warnings, a success message is shown to the user', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const spec = hclJob();
|
||||
const job = await this.store.createRecord('job');
|
||||
|
||||
@@ -392,6 +406,8 @@ module('Integration | Component | job-editor', function (hooks) {
|
||||
});
|
||||
|
||||
test('when the job-editor cancelable flag is true, there is a cancel button in the header', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
const job = await this.store.createRecord('job');
|
||||
|
||||
await renderEditJob(this, job);
|
||||
|
||||
@@ -32,6 +32,8 @@ module('Integration | Component | job-page/parts/body', function (hooks) {
|
||||
});
|
||||
|
||||
test('the subnav includes the deployments link when the job is a service', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const store = this.owner.lookup('service:store');
|
||||
const job = await store.createRecord('job', {
|
||||
id: 'service-job',
|
||||
|
||||
@@ -64,6 +64,8 @@ module('Integration | Component | job-page/parts/children', function (hooks) {
|
||||
});
|
||||
|
||||
test('eventually paginates', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
const pageSize = 10;
|
||||
window.localStorage.nomadPageSize = pageSize;
|
||||
|
||||
@@ -110,6 +112,8 @@ module('Integration | Component | job-page/parts/children', function (hooks) {
|
||||
});
|
||||
|
||||
test('is sorted based on the sortProperty and sortDescending properties', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
this.server.create('job', 'periodic', {
|
||||
id: 'parent',
|
||||
childrenCount: 3,
|
||||
|
||||
@@ -46,6 +46,8 @@ module(
|
||||
});
|
||||
|
||||
test('the latest deployment section shows up for the currently running deployment', async function (assert) {
|
||||
assert.expect(11);
|
||||
|
||||
this.server.create('job', {
|
||||
type: 'service',
|
||||
createAllocations: false,
|
||||
@@ -144,6 +146,8 @@ module(
|
||||
});
|
||||
|
||||
test('the latest deployment section can be expanded to show task groups and allocations', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
this.server.create('node');
|
||||
this.server.create('job', { type: 'service', activeDeployment: true });
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ module(
|
||||
});
|
||||
|
||||
test('when the job has placement failures, they are called out', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
this.server.create('job', {
|
||||
failedPlacements: true,
|
||||
createAllocations: false,
|
||||
|
||||
@@ -23,6 +23,8 @@ module('Integration | Component | job-page/parts/summary', function (hooks) {
|
||||
});
|
||||
|
||||
test('jobs with children use the children diagram', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.server.create('job', 'periodic', {
|
||||
createAllocations: false,
|
||||
});
|
||||
@@ -48,6 +50,8 @@ module('Integration | Component | job-page/parts/summary', function (hooks) {
|
||||
});
|
||||
|
||||
test('jobs without children use the allocations diagram', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.server.create('job', {
|
||||
createAllocations: false,
|
||||
});
|
||||
@@ -174,6 +178,8 @@ module('Integration | Component | job-page/parts/summary', function (hooks) {
|
||||
});
|
||||
|
||||
test('when collapsed, the summary block includes an inline version of the chart', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.server.create('job', {
|
||||
createAllocations: false,
|
||||
});
|
||||
|
||||
@@ -39,6 +39,8 @@ module(
|
||||
);
|
||||
|
||||
test('the job detail page should list all task groups', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
this.server.create('job', {
|
||||
createAllocations: false,
|
||||
});
|
||||
|
||||
@@ -142,6 +142,8 @@ module('Integration | Component | job-page/periodic', function (hooks) {
|
||||
});
|
||||
|
||||
test('Stopping a job sends a delete request for the job', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
const mirageJob = this.server.create('job', 'periodic', {
|
||||
childrenCount: 0,
|
||||
createAllocations: false,
|
||||
@@ -161,6 +163,8 @@ module('Integration | Component | job-page/periodic', function (hooks) {
|
||||
});
|
||||
|
||||
test('Stopping a job without proper permissions shows an error message', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
this.server.pretender.delete('/v1/job/:id', () => [403, {}, '']);
|
||||
|
||||
const mirageJob = this.server.create('job', 'periodic', {
|
||||
@@ -183,6 +187,8 @@ module('Integration | Component | job-page/periodic', function (hooks) {
|
||||
});
|
||||
|
||||
test('Starting a job sends a post request for the job using the current definition', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
const mirageJob = this.server.create('job', 'periodic', {
|
||||
childrenCount: 0,
|
||||
createAllocations: false,
|
||||
@@ -200,6 +206,8 @@ module('Integration | Component | job-page/periodic', function (hooks) {
|
||||
});
|
||||
|
||||
test('Starting a job without proper permissions shows an error message', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.server.pretender.post('/v1/job/:id', () => [403, {}, '']);
|
||||
|
||||
const mirageJob = this.server.create('job', 'periodic', {
|
||||
|
||||
@@ -63,6 +63,8 @@ module('Integration | Component | job-page/service', function (hooks) {
|
||||
);
|
||||
|
||||
test('Stopping a job sends a delete request for the job', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
const mirageJob = makeMirageJob(this.server);
|
||||
await this.store.findAll('job');
|
||||
|
||||
@@ -76,6 +78,8 @@ module('Integration | Component | job-page/service', function (hooks) {
|
||||
});
|
||||
|
||||
test('Stopping a job without proper permissions shows an error message', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
this.server.pretender.delete('/v1/job/:id', () => [403, {}, '']);
|
||||
|
||||
const mirageJob = makeMirageJob(this.server);
|
||||
@@ -93,6 +97,8 @@ module('Integration | Component | job-page/service', function (hooks) {
|
||||
});
|
||||
|
||||
test('Starting a job sends a post request for the job using the current definition', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
const mirageJob = makeMirageJob(this.server, { status: 'dead' });
|
||||
await this.store.findAll('job');
|
||||
|
||||
@@ -106,6 +112,8 @@ module('Integration | Component | job-page/service', function (hooks) {
|
||||
});
|
||||
|
||||
test('Starting a job without proper permissions shows an error message', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.server.pretender.post('/v1/job/:id', () => [403, {}, '']);
|
||||
|
||||
const mirageJob = makeMirageJob(this.server, { status: 'dead' });
|
||||
@@ -121,6 +129,8 @@ module('Integration | Component | job-page/service', function (hooks) {
|
||||
});
|
||||
|
||||
test('Recent allocations shows allocations in the job context', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.server.create('node');
|
||||
const mirageJob = makeMirageJob(this.server, { createAllocations: true });
|
||||
await this.store.findAll('job');
|
||||
@@ -165,6 +175,8 @@ module('Integration | Component | job-page/service', function (hooks) {
|
||||
});
|
||||
|
||||
test('Recent allocations shows an empty message when the job has no allocations', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
this.server.create('node');
|
||||
const mirageJob = makeMirageJob(this.server);
|
||||
|
||||
@@ -208,6 +220,8 @@ module('Integration | Component | job-page/service', function (hooks) {
|
||||
});
|
||||
|
||||
test('When promoting the active deployment fails, an error is shown', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
this.server.pretender.post('/v1/deployment/promote/:id', () => [
|
||||
403,
|
||||
{},
|
||||
@@ -272,6 +286,8 @@ module('Integration | Component | job-page/service', function (hooks) {
|
||||
});
|
||||
|
||||
test('When failing the active deployment fails, an error is shown', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
this.server.pretender.post('/v1/deployment/fail/:id', () => [403, {}, '']);
|
||||
|
||||
this.server.create('node');
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/no-conditional-assertions */
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, settled } from '@ember/test-helpers';
|
||||
@@ -44,6 +45,8 @@ module('Integration | Component | lifecycle-chart', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders stateless phases and lifecycle- and name-sorted tasks', async function (assert) {
|
||||
assert.expect(32);
|
||||
|
||||
this.set('tasks', tasks);
|
||||
|
||||
await render(hbs`<LifecycleChart @tasks={{tasks}} />`);
|
||||
@@ -109,6 +112,8 @@ module('Integration | Component | lifecycle-chart', function (hooks) {
|
||||
});
|
||||
|
||||
test('it reflects phase and task states when states are passed in', async function (assert) {
|
||||
assert.expect(24);
|
||||
|
||||
this.set(
|
||||
'taskStates',
|
||||
tasks.map((task) => {
|
||||
@@ -165,6 +170,8 @@ module('Integration | Component | lifecycle-chart', function (hooks) {
|
||||
},
|
||||
].forEach(async ({ testName, runningTaskNames, activePhaseNames }) => {
|
||||
test(testName, async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
this.set(
|
||||
'taskStates',
|
||||
tasks.map((task) => ({ task }))
|
||||
|
||||
@@ -18,6 +18,8 @@ module('Integration | Component | line-chart', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('when a chart has annotations, they are rendered in order', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const annotations = [
|
||||
{ x: 2, type: 'info' },
|
||||
{ x: 1, type: 'error' },
|
||||
@@ -55,6 +57,8 @@ module('Integration | Component | line-chart', function (hooks) {
|
||||
});
|
||||
|
||||
test('when a chart has annotations and is timeseries, annotations are sorted reverse-chronologically', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const annotations = [
|
||||
{
|
||||
x: moment(REF_DATE).add(2, 'd').toDate(),
|
||||
@@ -126,6 +130,8 @@ module('Integration | Component | line-chart', function (hooks) {
|
||||
});
|
||||
|
||||
test('annotations will have staggered heights when too close to be positioned side-by-side', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const annotations = [
|
||||
{ x: 2, type: 'info' },
|
||||
{ x: 2.4, type: 'error' },
|
||||
@@ -162,6 +168,8 @@ module('Integration | Component | line-chart', function (hooks) {
|
||||
});
|
||||
|
||||
test('horizontal annotations render in order', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const annotations = [
|
||||
{ y: 2, label: 'label one' },
|
||||
{ y: 9, label: 'label three' },
|
||||
@@ -196,6 +204,8 @@ module('Integration | Component | line-chart', function (hooks) {
|
||||
});
|
||||
|
||||
test('the tooltip includes information on the data closest to the mouse', async function (assert) {
|
||||
assert.expect(8);
|
||||
|
||||
const series1 = [
|
||||
{ x: 1, y: 2 },
|
||||
{ x: 3, y: 3 },
|
||||
|
||||
@@ -19,6 +19,8 @@ module('Integration | Component | list pagination', function (hooks) {
|
||||
.map((_, i) => i);
|
||||
|
||||
test('the source property', async function (assert) {
|
||||
assert.expect(36);
|
||||
|
||||
this.set('source', list100);
|
||||
await render(hbs`
|
||||
<ListPagination @source={{source}} as |p|>
|
||||
@@ -70,7 +72,7 @@ module('Integration | Component | list pagination', function (hooks) {
|
||||
);
|
||||
await componentA11yAudit(this.element, assert);
|
||||
|
||||
assert.ok(
|
||||
assert.equal(
|
||||
findAll('.item').length,
|
||||
defaults.size,
|
||||
`Only ${defaults.size} (the default) number of items are rendered`
|
||||
@@ -105,6 +107,8 @@ module('Integration | Component | list pagination', function (hooks) {
|
||||
});
|
||||
|
||||
test('the spread property', async function (assert) {
|
||||
assert.expect(12);
|
||||
|
||||
this.setProperties({
|
||||
source: list100,
|
||||
spread: 1,
|
||||
@@ -126,6 +130,8 @@ module('Integration | Component | list pagination', function (hooks) {
|
||||
});
|
||||
|
||||
test('page property', async function (assert) {
|
||||
assert.expect(10);
|
||||
|
||||
this.setProperties({
|
||||
source: list100,
|
||||
size: 5,
|
||||
@@ -184,6 +190,8 @@ module('Integration | Component | list pagination', function (hooks) {
|
||||
|
||||
// when there is less pages than the total spread amount
|
||||
test('when there is less pages than the total spread amount', async function (assert) {
|
||||
assert.expect(9);
|
||||
|
||||
this.setProperties({
|
||||
source: list100,
|
||||
spread: 4,
|
||||
|
||||
@@ -39,6 +39,8 @@ module('Integration | Component | list table', function (hooks) {
|
||||
|
||||
// tbody
|
||||
test('component exposes a tbody contextual component', async function (assert) {
|
||||
assert.expect(44);
|
||||
|
||||
this.setProperties({
|
||||
source: commonTable,
|
||||
sortProperty: 'firstName',
|
||||
|
||||
@@ -44,6 +44,8 @@ module('Integration | Component | multi-select dropdown', function (hooks) {
|
||||
`;
|
||||
|
||||
test('component is initially closed', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -63,6 +65,8 @@ module('Integration | Component | multi-select dropdown', function (hooks) {
|
||||
});
|
||||
|
||||
test('component opens the options dropdown when clicked', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -84,6 +88,8 @@ module('Integration | Component | multi-select dropdown', function (hooks) {
|
||||
});
|
||||
|
||||
test('all options are shown in the options dropdown, each with a checkbox input', async function (assert) {
|
||||
assert.expect(13);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -127,6 +133,8 @@ module('Integration | Component | multi-select dropdown', function (hooks) {
|
||||
});
|
||||
|
||||
test('the component trigger shows the selection count when there is a selection', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const props = commonProperties();
|
||||
props.selection = [props.options[0].key, props.options[1].key];
|
||||
this.setProperties(props);
|
||||
@@ -251,6 +259,8 @@ module('Integration | Component | multi-select dropdown', function (hooks) {
|
||||
});
|
||||
|
||||
test('pressing DOWN when the last list option has focus does nothing', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -265,6 +275,7 @@ module('Integration | Component | multi-select dropdown', function (hooks) {
|
||||
await triggerKeyEvent(option, 'keydown', ARROW_DOWN);
|
||||
|
||||
if (index < lastIndex) {
|
||||
/* eslint-disable-next-line qunit/no-conditional-assertions */
|
||||
assert.equal(
|
||||
document.activeElement,
|
||||
optionEls[index + 1],
|
||||
@@ -301,6 +312,8 @@ module('Integration | Component | multi-select dropdown', function (hooks) {
|
||||
});
|
||||
|
||||
test('list options have a zero tabindex and are therefore sequentially navigable', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -317,6 +330,8 @@ module('Integration | Component | multi-select dropdown', function (hooks) {
|
||||
});
|
||||
|
||||
test('the checkboxes inside list options have a negative tabindex and are therefore not sequentially navigable', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -366,6 +381,8 @@ module('Integration | Component | multi-select dropdown', function (hooks) {
|
||||
});
|
||||
|
||||
test('when there are no list options, an empty message is shown', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const props = commonProperties();
|
||||
props.options = [];
|
||||
this.setProperties(props);
|
||||
|
||||
@@ -17,6 +17,8 @@ module('Integration | Component | page layout', function (hooks) {
|
||||
});
|
||||
|
||||
test('the global-header hamburger menu opens the gutter menu', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
await render(hbs`<PageLayout />`);
|
||||
|
||||
assert.notOk(
|
||||
|
||||
@@ -14,6 +14,8 @@ module('Integration | Component | placement failures', function (hooks) {
|
||||
`;
|
||||
|
||||
test('should render the placement failure (basic render)', async function (assert) {
|
||||
assert.expect(12);
|
||||
|
||||
const name = 'Placement Failure';
|
||||
const failures = 11;
|
||||
this.set(
|
||||
@@ -92,6 +94,8 @@ module('Integration | Component | placement failures', function (hooks) {
|
||||
});
|
||||
|
||||
test('should render correctly when a node is not evaluated', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.set(
|
||||
'taskGroup',
|
||||
createFixture({
|
||||
|
||||
@@ -21,6 +21,8 @@ module('Integration | Component | plugin allocation row', function (hooks) {
|
||||
});
|
||||
|
||||
test('Plugin allocation row immediately fetches the plugin allocation', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
const plugin = this.server.create('csi-plugin', {
|
||||
id: 'plugin',
|
||||
controllerRequired: true,
|
||||
|
||||
@@ -32,6 +32,8 @@ module('Integration | Component | popover-menu', function (hooks) {
|
||||
`;
|
||||
|
||||
test('presents as a button with a chevron-down icon', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -44,6 +46,8 @@ module('Integration | Component | popover-menu', function (hooks) {
|
||||
});
|
||||
|
||||
test('clicking the trigger button toggles the popover menu', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
|
||||
@@ -49,6 +49,8 @@ module('Integration | Component | PrimaryMetric::Allocation', function (hooks) {
|
||||
store.peekAll('allocation').get('firstObject');
|
||||
|
||||
test('Must pass an accessibility audit', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
await preload(this.store);
|
||||
|
||||
const resource = findResource(this.store);
|
||||
|
||||
@@ -37,6 +37,8 @@ module('Integration | Component | PrimaryMetric::Node', function (hooks) {
|
||||
const findResource = (store) => store.peekAll('node').get('firstObject');
|
||||
|
||||
test('Must pass an accessibility audit', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
await preload(this.store);
|
||||
|
||||
const resource = findResource(this.store);
|
||||
|
||||
@@ -104,9 +104,12 @@ export function primaryMetric({ template, findResource, preload }) {
|
||||
|
||||
await render(template);
|
||||
|
||||
assert.ok(
|
||||
const spy =
|
||||
this.getTrackerSpy.calledWith(resource) ||
|
||||
this.getTrackerSpy.calledWith(resource.allocation),
|
||||
this.getTrackerSpy.calledWith(resource.allocation);
|
||||
|
||||
assert.ok(
|
||||
spy,
|
||||
'Uses the tracker registry to get the tracker for the provided resource'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -55,6 +55,8 @@ module('Integration | Component | PrimaryMetric::Task', function (hooks) {
|
||||
store.peekAll('allocation').get('firstObject.states.firstObject');
|
||||
|
||||
test('Must pass an accessibility audit', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
await preload(this.store);
|
||||
|
||||
const resource = findResource(this.store);
|
||||
|
||||
@@ -26,6 +26,8 @@ module('Integration | Component | reschedule event timeline', function (hooks) {
|
||||
`;
|
||||
|
||||
test('when the allocation is running, the timeline shows past allocations', async function (assert) {
|
||||
assert.expect(7);
|
||||
|
||||
const attempts = 2;
|
||||
|
||||
this.server.create('allocation', 'rescheduled', {
|
||||
@@ -75,6 +77,8 @@ module('Integration | Component | reschedule event timeline', function (hooks) {
|
||||
});
|
||||
|
||||
test('when the allocation has failed and there is a follow up evaluation, a note with a time is shown', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const attempts = 2;
|
||||
|
||||
this.server.create('allocation', 'rescheduled', {
|
||||
@@ -104,6 +108,8 @@ module('Integration | Component | reschedule event timeline', function (hooks) {
|
||||
});
|
||||
|
||||
test('when the allocation has failed and there is no follow up evaluation, a warning is shown', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const attempts = 2;
|
||||
|
||||
this.server.create('allocation', 'rescheduled', {
|
||||
@@ -155,7 +161,7 @@ module('Integration | Component | reschedule event timeline', function (hooks) {
|
||||
this.set('allocation', allocation);
|
||||
await render(commonTemplate);
|
||||
|
||||
assert.ok(
|
||||
assert.equal(
|
||||
find('[data-test-reschedule-label]').textContent.trim(),
|
||||
'Next Allocation',
|
||||
'The first allocation is the next allocation and labeled as such'
|
||||
|
||||
@@ -39,6 +39,8 @@ module('Integration | Component | scale-events-accordion', function (hooks) {
|
||||
const commonTemplate = hbs`<ScaleEventsAccordion @events={{this.events}} />`;
|
||||
|
||||
test('it shows an accordion with an entry for each event', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
const eventCount = 5;
|
||||
const taskGroup = await this.taskGroupWithEvents(
|
||||
server.createList('scale-event', eventCount)
|
||||
@@ -55,6 +57,8 @@ module('Integration | Component | scale-events-accordion', function (hooks) {
|
||||
});
|
||||
|
||||
test('when an event is an error, an error icon is shown', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
const taskGroup = await this.taskGroupWithEvents(
|
||||
server.createList('scale-event', 1, { error: true })
|
||||
);
|
||||
@@ -67,6 +71,8 @@ module('Integration | Component | scale-events-accordion', function (hooks) {
|
||||
});
|
||||
|
||||
test('when an event has a count higher than previous count, a danger up arrow is shown', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const count = 5;
|
||||
const taskGroup = await this.taskGroupWithEvents(
|
||||
server.createList('scale-event', 1, {
|
||||
@@ -124,6 +130,8 @@ module('Integration | Component | scale-events-accordion', function (hooks) {
|
||||
});
|
||||
|
||||
test('when an event has no meta properties, the accordion entry is not expandable', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
const taskGroup = await this.taskGroupWithEvents(
|
||||
server.createList('scale-event', 1, { meta: {} })
|
||||
);
|
||||
@@ -138,6 +146,8 @@ module('Integration | Component | scale-events-accordion', function (hooks) {
|
||||
});
|
||||
|
||||
test('when an event has meta properties, the accordion entry is expanding, presenting the meta properties in a json viewer', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const meta = {
|
||||
prop: 'one',
|
||||
prop2: 'two',
|
||||
|
||||
@@ -52,6 +52,8 @@ module('Integration | Component | scale-events-chart', function (hooks) {
|
||||
];
|
||||
|
||||
test('each event is rendered as an annotation', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
this.set('events', events);
|
||||
await render(hbs`<ScaleEventsChart @events={{this.events}} />`);
|
||||
|
||||
@@ -63,6 +65,8 @@ module('Integration | Component | scale-events-chart', function (hooks) {
|
||||
});
|
||||
|
||||
test('clicking an annotation presents details for the event', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
const annotation = events.rejectBy('hasCount').sortBy('time').reverse()[0];
|
||||
|
||||
this.set('events', events);
|
||||
|
||||
@@ -35,6 +35,8 @@ module('Integration | Component | single-select dropdown', function (hooks) {
|
||||
`;
|
||||
|
||||
test('component shows label and selection in the trigger', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -53,6 +55,8 @@ module('Integration | Component | single-select dropdown', function (hooks) {
|
||||
});
|
||||
|
||||
test('all options are shown in the dropdown', async function (assert) {
|
||||
assert.expect(7);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
|
||||
@@ -46,6 +46,8 @@ module('Integration | Component | stepper input', function (hooks) {
|
||||
`;
|
||||
|
||||
test('basic appearance includes a label, an input, and two buttons', async function (assert) {
|
||||
assert.expect(7);
|
||||
|
||||
this.setProperties(commonProperties());
|
||||
|
||||
await render(commonTemplate);
|
||||
|
||||
@@ -45,6 +45,8 @@ module('Integration | Component | streaming file', function (hooks) {
|
||||
`;
|
||||
|
||||
test('when mode is `head`, the logger signals head', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
const url = '/file/endpoint';
|
||||
const params = { path: 'hello/world.txt', offset: 0, limit: 50000 };
|
||||
this.setProperties({
|
||||
|
||||
@@ -70,6 +70,8 @@ module('Integration | Component | task group row', function (hooks) {
|
||||
`;
|
||||
|
||||
test('Task group row conditionally shows scaling buttons based on the presence of the scaling attr on the task group', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
makeJob(this.server, { noActiveDeployment: true });
|
||||
this.token.fetchSelfTokenAndPolicies.perform();
|
||||
await settled();
|
||||
@@ -122,6 +124,8 @@ module('Integration | Component | task group row', function (hooks) {
|
||||
});
|
||||
|
||||
test('When the current count is equal to the max count, the increment count button is disabled', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
makeJob(this.server, { noActiveDeployment: true });
|
||||
this.token.fetchSelfTokenAndPolicies.perform();
|
||||
await settled();
|
||||
@@ -138,6 +142,8 @@ module('Integration | Component | task group row', function (hooks) {
|
||||
});
|
||||
|
||||
test('When the current count is equal to the min count, the decrement count button is disabled', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
makeJob(this.server, { noActiveDeployment: true });
|
||||
this.token.fetchSelfTokenAndPolicies.perform();
|
||||
await settled();
|
||||
@@ -154,6 +160,8 @@ module('Integration | Component | task group row', function (hooks) {
|
||||
});
|
||||
|
||||
test('When there is an active deployment, both scale buttons are disabled', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
makeJob(this.server, { activeDeployment: true });
|
||||
this.token.fetchSelfTokenAndPolicies.perform();
|
||||
await settled();
|
||||
|
||||
@@ -73,6 +73,8 @@ module('Integration | Component | task log', function (hooks) {
|
||||
});
|
||||
|
||||
test('Basic appearance', async function (assert) {
|
||||
assert.expect(8);
|
||||
|
||||
run.later(run, run.cancelTimers, commonProps.interval);
|
||||
|
||||
this.setProperties(commonProps);
|
||||
@@ -103,6 +105,8 @@ module('Integration | Component | task log', function (hooks) {
|
||||
});
|
||||
|
||||
test('Streaming starts on creation', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
run.later(run, run.cancelTimers, commonProps.interval);
|
||||
|
||||
this.setProperties(commonProps);
|
||||
@@ -180,6 +184,8 @@ module('Integration | Component | task log', function (hooks) {
|
||||
});
|
||||
|
||||
test('Clicking toggleStream starts and stops the log stream', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
run.later(run, run.cancelTimers, commonProps.interval);
|
||||
|
||||
const { interval } = commonProps;
|
||||
@@ -300,6 +306,8 @@ module('Integration | Component | task log', function (hooks) {
|
||||
});
|
||||
|
||||
test('When both the client and the server are inaccessible, an error message is shown', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
run.later(run, run.cancelTimers, allowedConnectionTime * 5);
|
||||
|
||||
// override client and server responses to timeout
|
||||
|
||||
@@ -29,6 +29,8 @@ module('Integration | Component | toggle', function (hooks) {
|
||||
`;
|
||||
|
||||
test('presents as a label with an inner checkbox and display span, and text', async function (assert) {
|
||||
assert.expect(7);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -52,6 +54,8 @@ module('Integration | Component | toggle', function (hooks) {
|
||||
});
|
||||
|
||||
test('the isActive property dictates the active state and class', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -69,6 +73,8 @@ module('Integration | Component | toggle', function (hooks) {
|
||||
});
|
||||
|
||||
test('the isDisabled property dictates the disabled state and class', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
|
||||
@@ -45,6 +45,8 @@ module('Integration | Component | TopoViz', function (hooks) {
|
||||
`;
|
||||
|
||||
test('presents as a FlexMasonry of datacenters', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
this.setProperties({
|
||||
nodes: [node('dc1', 'node0', 1000, 500), node('dc2', 'node1', 1000, 500)],
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ module('Integration | Component | TopoViz::Datacenter', function (hooks) {
|
||||
`;
|
||||
|
||||
test('presents as a div with a label and a FlexMasonry with a collection of nodes', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.setProperties(
|
||||
commonProps({
|
||||
datacenter: {
|
||||
@@ -148,6 +150,8 @@ module('Integration | Component | TopoViz::Datacenter', function (hooks) {
|
||||
});
|
||||
|
||||
test('args get passed down to the TopViz::Node children', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const heightSpy = sinon.spy();
|
||||
this.setProperties(
|
||||
commonProps({
|
||||
|
||||
@@ -65,6 +65,8 @@ module('Integration | Component | TopoViz::Node', function (hooks) {
|
||||
`;
|
||||
|
||||
test('presents as a div with a label and an svg with CPU and memory rows', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const node = nodeGen('Node One', 'dc1', 1000, 1000);
|
||||
this.setProperties(
|
||||
props({
|
||||
@@ -260,6 +262,8 @@ module('Integration | Component | TopoViz::Node', function (hooks) {
|
||||
});
|
||||
|
||||
test('each allocation is sized according to its percentage of utilization', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const node = nodeGen('Node One', 'dc1', 1000, 1000);
|
||||
this.setProperties(
|
||||
props({
|
||||
@@ -380,6 +384,8 @@ module('Integration | Component | TopoViz::Node', function (hooks) {
|
||||
});
|
||||
|
||||
test('allocations are sorted by smallest to largest delta of memory to cpu percent utilizations', async function (assert) {
|
||||
assert.expect(10);
|
||||
|
||||
const node = nodeGen('Node One', 'dc1', 1000, 1000);
|
||||
|
||||
const evenAlloc = allocGen(node, 100, 100);
|
||||
|
||||
@@ -36,6 +36,8 @@ module('Integration | Component | two step button', function (hooks) {
|
||||
`;
|
||||
|
||||
test('presents as a button in the idle state', async function (assert) {
|
||||
assert.expect(6);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -58,6 +60,8 @@ module('Integration | Component | two step button', function (hooks) {
|
||||
});
|
||||
|
||||
test('clicking the idle state button transitions into the promptForConfirmation state', async function (assert) {
|
||||
assert.expect(7);
|
||||
|
||||
const props = commonProperties();
|
||||
this.setProperties(props);
|
||||
await render(commonTemplate);
|
||||
@@ -115,6 +119,8 @@ module('Integration | Component | two step button', function (hooks) {
|
||||
});
|
||||
|
||||
test('when awaitingConfirmation is true, the cancel and submit buttons are disabled and the submit button is loading', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
const props = commonProperties();
|
||||
props.awaitingConfirmation = true;
|
||||
this.setProperties(props);
|
||||
@@ -179,6 +185,8 @@ module('Integration | Component | two step button', function (hooks) {
|
||||
});
|
||||
|
||||
test('when disabled is true, the idle button is disabled', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
const props = commonProperties();
|
||||
props.disabled = true;
|
||||
this.setProperties(props);
|
||||
|
||||
@@ -12,6 +12,8 @@ module(
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it can wrap to a previous line while backspacing', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
let done = assert.async();
|
||||
|
||||
await render(hbs`
|
||||
@@ -52,6 +54,8 @@ module(
|
||||
});
|
||||
|
||||
test('it ignores arrow keys and unprintable characters other than ^U', async function (assert) {
|
||||
assert.expect(4);
|
||||
|
||||
let done = assert.async();
|
||||
|
||||
await render(hbs`
|
||||
@@ -95,6 +99,8 @@ module(
|
||||
});
|
||||
|
||||
test('it supports typing ^U to delete the entire command', async function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
let done = assert.async();
|
||||
|
||||
await render(hbs`
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable qunit/no-conditional-assertions */
|
||||
import ExecSocketXtermAdapter from 'nomad-ui/utils/classes/exec-socket-xterm-adapter';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { module, test } from 'qunit';
|
||||
@@ -11,6 +12,8 @@ module('Integration | Utility | exec-socket-xterm-adapter', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('initiating socket sends authentication handshake', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
let done = assert.async();
|
||||
|
||||
let terminal = new Terminal();
|
||||
@@ -43,6 +46,8 @@ module('Integration | Utility | exec-socket-xterm-adapter', function (hooks) {
|
||||
});
|
||||
|
||||
test('initiating socket sends authentication handshake even if unauthenticated', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
let done = assert.async();
|
||||
|
||||
let terminal = new Terminal();
|
||||
@@ -75,6 +80,8 @@ module('Integration | Utility | exec-socket-xterm-adapter', function (hooks) {
|
||||
});
|
||||
|
||||
test('a heartbeat is sent periodically', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
let done = assert.async();
|
||||
|
||||
const clock = sinon.useFakeTimers({
|
||||
@@ -107,6 +114,8 @@ module('Integration | Utility | exec-socket-xterm-adapter', function (hooks) {
|
||||
});
|
||||
|
||||
test('resizing the window passes a resize message through the socket', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
let done = assert.async();
|
||||
|
||||
let terminal = new Terminal();
|
||||
|
||||
@@ -46,6 +46,8 @@ module('Unit | Component | stats-time-series', function (hooks) {
|
||||
];
|
||||
|
||||
test('xFormat is time-formatted for hours, minutes, and seconds', function (assert) {
|
||||
assert.expect(11);
|
||||
|
||||
const chart = this.createComponent({ data: wideData });
|
||||
|
||||
wideData.forEach((datum) => {
|
||||
@@ -57,6 +59,8 @@ module('Unit | Component | stats-time-series', function (hooks) {
|
||||
});
|
||||
|
||||
test('yFormat is percent-formatted', function (assert) {
|
||||
assert.expect(11);
|
||||
|
||||
const chart = this.createComponent({ data: wideData });
|
||||
|
||||
wideData.forEach((datum) => {
|
||||
|
||||
@@ -58,6 +58,8 @@ module('Unit | Component | TopoViz', function (hooks) {
|
||||
});
|
||||
|
||||
test('the topology object contains an allocation index keyed by jobId+taskGroupName', async function (assert) {
|
||||
assert.expect(7);
|
||||
|
||||
const allocations = [
|
||||
alloc({ nodeId: 'node0', jobId: 'job0', taskGroupName: 'one' }),
|
||||
alloc({ nodeId: 'node0', jobId: 'job0', taskGroupName: 'one' }),
|
||||
|
||||
@@ -64,6 +64,8 @@ module('Unit | Model | task-group', function (hooks) {
|
||||
});
|
||||
|
||||
test("should expose mergedMeta as merged with the job's meta", function (assert) {
|
||||
assert.expect(8);
|
||||
|
||||
const store = this.owner.lookup('service:store');
|
||||
|
||||
const jobWithMeta = run(() =>
|
||||
|
||||
@@ -7,6 +7,8 @@ module('Unit | Model | task', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test("should expose mergedMeta as merged with the job's and task groups's meta", function (assert) {
|
||||
assert.expect(8);
|
||||
|
||||
const job = run(() =>
|
||||
this.owner.lookup('service:store').createRecord('job', {
|
||||
name: 'example',
|
||||
|
||||
@@ -133,6 +133,8 @@ module('Unit | Util | AllocationStatsTracker', function () {
|
||||
});
|
||||
|
||||
test('the tasks list comes from the allocation', async function (assert) {
|
||||
assert.expect(7);
|
||||
|
||||
const allocation = MockAllocation();
|
||||
const tracker = AllocationStatsTracker.create({ fetch, allocation });
|
||||
|
||||
@@ -473,6 +475,8 @@ module('Unit | Util | AllocationStatsTracker', function () {
|
||||
});
|
||||
|
||||
test('each stat list has maxLength equal to bufferSize', async function (assert) {
|
||||
assert.expect(16);
|
||||
|
||||
const allocation = MockAllocation();
|
||||
const bufferSize = 10;
|
||||
const tracker = AllocationStatsTracker.create({
|
||||
|
||||
@@ -80,6 +80,8 @@ module('Unit | Util | Log', function (hooks) {
|
||||
});
|
||||
|
||||
test('gotoHead builds the correct URL', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
const mocks = makeMocks('');
|
||||
const expectedUrl = `${mocks.url}?a=param&another=one&offset=0&origin=start`;
|
||||
const log = Log.create(mocks);
|
||||
@@ -119,6 +121,8 @@ module('Unit | Util | Log', function (hooks) {
|
||||
});
|
||||
|
||||
test('gotoTail builds the correct URL', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
const mocks = makeMocks('');
|
||||
const expectedUrl = `${mocks.url}?a=param&another=one&offset=50000&origin=end`;
|
||||
const log = Log.create(mocks);
|
||||
|
||||
Reference in New Issue
Block a user