From 2032813bb6608f46ecb7a897d788f39d240efd64 Mon Sep 17 00:00:00 2001 From: Jai Bhagat Date: Tue, 28 Dec 2021 14:30:38 -0500 Subject: [PATCH] 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. --- ui/tests/acceptance/allocation-detail-test.js | 3 ++ .../acceptance/application-errors-test.js | 2 ++ ui/tests/acceptance/behaviors/fs.js | 1 + ui/tests/acceptance/client-detail-test.js | 3 ++ ui/tests/acceptance/clients-list-test.js | 1 + ui/tests/acceptance/exec-test.js | 1 + ui/tests/acceptance/job-allocations-test.js | 1 + ui/tests/acceptance/job-clients-test.js | 3 ++ ui/tests/acceptance/job-definition-test.js | 2 ++ ui/tests/acceptance/job-deployments-test.js | 4 ++- ui/tests/acceptance/job-detail-test.js | 1 + ui/tests/acceptance/job-dispatch-test.js | 2 ++ ui/tests/acceptance/job-evaluations-test.js | 1 + ui/tests/acceptance/job-run-test.js | 2 ++ ui/tests/acceptance/job-versions-test.js | 4 ++- ui/tests/acceptance/jobs-list-test.js | 1 + ui/tests/acceptance/optimize-test.js | 2 ++ .../acceptance/plugin-allocations-test.js | 1 + ui/tests/acceptance/plugin-detail-test.js | 1 + ui/tests/acceptance/plugins-list-test.js | 1 + ui/tests/acceptance/regions-test.js | 2 ++ ui/tests/acceptance/search-test.js | 5 +-- ui/tests/acceptance/server-detail-test.js | 1 + ui/tests/acceptance/server-monitor-test.js | 2 ++ ui/tests/acceptance/servers-list-test.js | 1 + ui/tests/acceptance/task-group-detail-test.js | 2 ++ ui/tests/acceptance/task-logs-test.js | 1 + ui/tests/acceptance/token-test.js | 2 ++ ui/tests/acceptance/topology-test.js | 2 ++ ui/tests/acceptance/volume-detail-test.js | 1 + ui/tests/acceptance/volumes-list-test.js | 1 + ui/tests/helpers/glimmer-factory.js | 32 +++++++++++-------- ui/tests/helpers/module-for-job.js | 2 ++ .../components/agent-monitor-test.js | 2 ++ .../components/allocation-row-test.js | 14 ++++---- .../components/app-breadcrumbs-test.js | 8 +++-- .../components/attributes-table-test.js | 2 ++ .../components/copy-button-test.js | 6 ++++ .../components/das/dismissed-test.js | 4 +++ .../das/recommendation-card-test.js | 2 ++ .../das/recommendation-chart-test.js | 6 ++++ .../components/flex-masonry-test.js | 11 +++++++ .../integration/components/fs/file-test.js | 8 +++++ .../components/gauge-chart-test.js | 2 ++ .../integration/components/image-file-test.js | 2 ++ .../components/job-client-status-bar-test.js | 2 ++ .../integration/components/job-diff-test.js | 4 +++ .../integration/components/job-editor-test.js | 16 ++++++++++ .../components/job-page/parts/body-test.js | 2 ++ .../job-page/parts/children-test.js | 4 +++ .../job-page/parts/latest-deployment-test.js | 4 +++ .../job-page/parts/placement-failures-test.js | 2 ++ .../components/job-page/parts/summary-test.js | 6 ++++ .../job-page/parts/task-groups-test.js | 2 ++ .../components/job-page/periodic-test.js | 8 +++++ .../components/job-page/service-test.js | 16 ++++++++++ .../components/lifecycle-chart-test.js | 7 ++++ .../integration/components/line-chart-test.js | 10 ++++++ .../components/list-pagination-test.js | 10 +++++- .../integration/components/list-table-test.js | 2 ++ .../components/multi-select-dropdown-test.js | 17 ++++++++++ .../components/page-layout-test.js | 2 ++ .../components/placement-failure-test.js | 4 +++ .../components/plugin-allocation-row-test.js | 2 ++ .../components/popover-menu-test.js | 4 +++ .../primary-metric/allocation-test.js | 2 ++ .../components/primary-metric/node-test.js | 2 ++ .../primary-metric/primary-metric.js | 7 ++-- .../components/primary-metric/task-test.js | 2 ++ .../reschedule-event-timeline-test.js | 8 ++++- .../components/scale-events-accordion-test.js | 10 ++++++ .../components/scale-events-chart-test.js | 4 +++ .../components/single-select-dropdown-test.js | 4 +++ .../components/stepper-input-test.js | 2 ++ .../components/streaming-file-test.js | 2 ++ .../components/task-group-row-test.js | 8 +++++ .../integration/components/task-log-test.js | 8 +++++ .../integration/components/toggle-test.js | 6 ++++ .../integration/components/topo-viz-test.js | 2 ++ .../components/topo-viz/datacenter-test.js | 4 +++ .../components/topo-viz/node-test.js | 6 ++++ .../components/two-step-button-test.js | 8 +++++ .../exec-command-editor-xterm-adapter-test.js | 6 ++++ .../util/exec-socket-xterm-adapter-test.js | 9 ++++++ .../unit/components/stats-time-series-test.js | 4 +++ ui/tests/unit/components/topo-viz-test.js | 2 ++ ui/tests/unit/models/task-group-test.js | 2 ++ ui/tests/unit/models/task-test.js | 2 ++ .../utils/allocation-stats-tracker-test.js | 4 +++ ui/tests/unit/utils/log-test.js | 4 +++ 90 files changed, 369 insertions(+), 31 deletions(-) diff --git a/ui/tests/acceptance/allocation-detail-test.js b/ui/tests/acceptance/allocation-detail-test.js index 4a6809bf94d..0d6dbe204ac 100644 --- a/ui/tests/acceptance/allocation-detail-test.js +++ b/ui/tests/acceptance/allocation-detail-test.js @@ -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}`, diff --git a/ui/tests/acceptance/application-errors-test.js b/ui/tests/acceptance/application-errors-test.js index 114e970bd79..ecd390be594 100644 --- a/ui/tests/acceptance/application-errors-test.js +++ b/ui/tests/acceptance/application-errors-test.js @@ -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); diff --git a/ui/tests/acceptance/behaviors/fs.js b/ui/tests/acceptance/behaviors/fs.js index f99183d9c06..c6a1f4a57d7 100644 --- a/ui/tests/acceptance/behaviors/fs.js +++ b/ui/tests/acceptance/behaviors/fs.js @@ -1,3 +1,4 @@ +/* eslint-disable qunit/require-expect */ import { test } from 'qunit'; import { currentURL, visit } from '@ember/test-helpers'; diff --git a/ui/tests/acceptance/client-detail-test.js b/ui/tests/acceptance/client-detail-test.js index 94a319bc06a..ff7827cef0c 100644 --- a/ui/tests/acceptance/client-detail-test.js +++ b/ui/tests/acceptance/client-detail-test.js @@ -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'; diff --git a/ui/tests/acceptance/clients-list-test.js b/ui/tests/acceptance/clients-list-test.js index 538810ac5c6..37b3bf97b66 100644 --- a/ui/tests/acceptance/clients-list-test.js +++ b/ui/tests/acceptance/clients-list-test.js @@ -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'; diff --git a/ui/tests/acceptance/exec-test.js b/ui/tests/acceptance/exec-test.js index 21b5495758b..b37f164fa5d 100644 --- a/ui/tests/acceptance/exec-test.js +++ b/ui/tests/acceptance/exec-test.js @@ -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'; diff --git a/ui/tests/acceptance/job-allocations-test.js b/ui/tests/acceptance/job-allocations-test.js index 2cfec901a29..4f276316d99 100644 --- a/ui/tests/acceptance/job-allocations-test.js +++ b/ui/tests/acceptance/job-allocations-test.js @@ -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'; diff --git a/ui/tests/acceptance/job-clients-test.js b/ui/tests/acceptance/job-clients-test.js index c4d9f7b20cd..4af17e15dc4 100644 --- a/ui/tests/acceptance/job-clients-test.js +++ b/ui/tests/acceptance/job-clients-test.js @@ -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; } diff --git a/ui/tests/acceptance/job-definition-test.js b/ui/tests/acceptance/job-definition-test.js index 08eb59e7d68..c8948645fcf 100644 --- a/ui/tests/acceptance/job-definition-test.js +++ b/ui/tests/acceptance/job-definition-test.js @@ -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'); }); diff --git a/ui/tests/acceptance/job-deployments-test.js b/ui/tests/acceptance/job-deployments-test.js index 68c621b8d15..fd168075573 100644 --- a/ui/tests/acceptance/job-deployments-test.js +++ b/ui/tests/acceptance/job-deployments-test.js @@ -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' diff --git a/ui/tests/acceptance/job-detail-test.js b/ui/tests/acceptance/job-detail-test.js index 68147cdc657..e6027ef3c95 100644 --- a/ui/tests/acceptance/job-detail-test.js +++ b/ui/tests/acceptance/job-detail-test.js @@ -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'; diff --git a/ui/tests/acceptance/job-dispatch-test.js b/ui/tests/acceptance/job-dispatch-test.js index ffae782a440..ef476431074 100644 --- a/ui/tests/acceptance/job-dispatch-test.js +++ b/ui/tests/acceptance/job-dispatch-test.js @@ -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'; diff --git a/ui/tests/acceptance/job-evaluations-test.js b/ui/tests/acceptance/job-evaluations-test.js index b0bb474e98a..d77eab4f8f4 100644 --- a/ui/tests/acceptance/job-evaluations-test.js +++ b/ui/tests/acceptance/job-evaluations-test.js @@ -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'; diff --git a/ui/tests/acceptance/job-run-test.js b/ui/tests/acceptance/job-run-test.js index c4ee3154c48..619ae0da79c 100644 --- a/ui/tests/acceptance/job-run-test.js +++ b/ui/tests/acceptance/job-run-test.js @@ -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); }); diff --git a/ui/tests/acceptance/job-versions-test.js b/ui/tests/acceptance/job-versions-test.js index a1eb313adf1..af43ded0a28 100644 --- a/ui/tests/acceptance/job-versions-test.js +++ b/ui/tests/acceptance/job-versions-test.js @@ -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' diff --git a/ui/tests/acceptance/jobs-list-test.js b/ui/tests/acceptance/jobs-list-test.js index c3e3222edb1..2a46b064969 100644 --- a/ui/tests/acceptance/jobs-list-test.js +++ b/ui/tests/acceptance/jobs-list-test.js @@ -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'; diff --git a/ui/tests/acceptance/optimize-test.js b/ui/tests/acceptance/optimize-test.js index 676f42989de..ec1e291fd24 100644 --- a/ui/tests/acceptance/optimize-test.js +++ b/ui/tests/acceptance/optimize-test.js @@ -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'; diff --git a/ui/tests/acceptance/plugin-allocations-test.js b/ui/tests/acceptance/plugin-allocations-test.js index e841c80e8ce..5f85c6203c9 100644 --- a/ui/tests/acceptance/plugin-allocations-test.js +++ b/ui/tests/acceptance/plugin-allocations-test.js @@ -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'; diff --git a/ui/tests/acceptance/plugin-detail-test.js b/ui/tests/acceptance/plugin-detail-test.js index 0ccc7732589..fe00f8419a1 100644 --- a/ui/tests/acceptance/plugin-detail-test.js +++ b/ui/tests/acceptance/plugin-detail-test.js @@ -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'; diff --git a/ui/tests/acceptance/plugins-list-test.js b/ui/tests/acceptance/plugins-list-test.js index 4abbf3bc571..3660ec9db14 100644 --- a/ui/tests/acceptance/plugins-list-test.js +++ b/ui/tests/acceptance/plugins-list-test.js @@ -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'; diff --git a/ui/tests/acceptance/regions-test.js b/ui/tests/acceptance/regions-test.js index 3700ab0ae8b..fc3ba70268f 100644 --- a/ui/tests/acceptance/regions-test.js +++ b/ui/tests/acceptance/regions-test.js @@ -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'; diff --git a/ui/tests/acceptance/search-test.js b/ui/tests/acceptance/search-test.js index a9f66efbca8..78a0fbd2bd9 100644 --- a/ui/tests/acceptance/search-test.js +++ b/ui/tests/acceptance/search-test.js @@ -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' diff --git a/ui/tests/acceptance/server-detail-test.js b/ui/tests/acceptance/server-detail-test.js index 058dd2b7da3..ef8b761f5ff 100644 --- a/ui/tests/acceptance/server-detail-test.js +++ b/ui/tests/acceptance/server-detail-test.js @@ -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'; diff --git a/ui/tests/acceptance/server-monitor-test.js b/ui/tests/acceptance/server-monitor-test.js index 384d7df1e7a..b6b174a3f71 100644 --- a/ui/tests/acceptance/server-monitor-test.js +++ b/ui/tests/acceptance/server-monitor-test.js @@ -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); }); diff --git a/ui/tests/acceptance/servers-list-test.js b/ui/tests/acceptance/servers-list-test.js index 163b292d115..6c6a12abbf3 100644 --- a/ui/tests/acceptance/servers-list-test.js +++ b/ui/tests/acceptance/servers-list-test.js @@ -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'; diff --git a/ui/tests/acceptance/task-group-detail-test.js b/ui/tests/acceptance/task-group-detail-test.js index 5ab558b9e02..e5378f0afcf 100644 --- a/ui/tests/acceptance/task-group-detail-test.js +++ b/ui/tests/acceptance/task-group-detail-test.js @@ -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'; diff --git a/ui/tests/acceptance/task-logs-test.js b/ui/tests/acceptance/task-logs-test.js index 51f95355b34..90ca1e9b3dc 100644 --- a/ui/tests/acceptance/task-logs-test.js +++ b/ui/tests/acceptance/task-logs-test.js @@ -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'; diff --git a/ui/tests/acceptance/token-test.js b/ui/tests/acceptance/token-test.js index 3e20d441c93..96a1275e14a 100644 --- a/ui/tests/acceptance/token-test.js +++ b/ui/tests/acceptance/token-test.js @@ -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); }); diff --git a/ui/tests/acceptance/topology-test.js b/ui/tests/acceptance/topology-test.js index 7920f2484a5..a12cb888021 100644 --- a/ui/tests/acceptance/topology-test.js +++ b/ui/tests/acceptance/topology-test.js @@ -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); diff --git a/ui/tests/acceptance/volume-detail-test.js b/ui/tests/acceptance/volume-detail-test.js index e34b1c60bdd..fb264110acf 100644 --- a/ui/tests/acceptance/volume-detail-test.js +++ b/ui/tests/acceptance/volume-detail-test.js @@ -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'; diff --git a/ui/tests/acceptance/volumes-list-test.js b/ui/tests/acceptance/volumes-list-test.js index 1d028b200b2..0876aa36a1b 100644 --- a/ui/tests/acceptance/volumes-list-test.js +++ b/ui/tests/acceptance/volumes-list-test.js @@ -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'; diff --git a/ui/tests/helpers/glimmer-factory.js b/ui/tests/helpers/glimmer-factory.js index 6625a7f2a06..3326155dce8 100644 --- a/ui/tests/helpers/glimmer-factory.js +++ b/ui/tests/helpers/glimmer-factory.js @@ -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( diff --git a/ui/tests/helpers/module-for-job.js b/ui/tests/helpers/module-for-job.js index b293f8bdca2..f873a0452bb 100644 --- a/ui/tests/helpers/module-for-job.js +++ b/ui/tests/helpers/module-for-job.js @@ -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'; diff --git a/ui/tests/integration/components/agent-monitor-test.js b/ui/tests/integration/components/agent-monitor-test.js index d4e08caf3a9..13947a385d0 100644 --- a/ui/tests/integration/components/agent-monitor-test.js +++ b/ui/tests/integration/components/agent-monitor-test.js @@ -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' }, diff --git a/ui/tests/integration/components/allocation-row-test.js b/ui/tests/integration/components/allocation-row-test.js index b985665d4a7..97caad096fa 100644 --- a/ui/tests/integration/components/allocation-row-test.js +++ b/ui/tests/integration/components/allocation-row-test.js @@ -35,7 +35,7 @@ module('Integration | Component | allocation row', function(hooks) { JSON.stringify({ ResourceUsage: generateResources() }), null, 'Valid JSON', - 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 diff --git a/ui/tests/integration/components/app-breadcrumbs-test.js b/ui/tests/integration/components/app-breadcrumbs-test.js index bc3d18c054d..9c95f79b894 100644 --- a/ui/tests/integration/components/app-breadcrumbs-test.js +++ b/ui/tests/integration/components/app-breadcrumbs-test.js @@ -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/ 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); diff --git a/ui/tests/integration/components/attributes-table-test.js b/ui/tests/integration/components/attributes-table-test.js index 0e4e03b67fa..ac7873838f4 100644 --- a/ui/tests/integration/components/attributes-table-test.js +++ b/ui/tests/integration/components/attributes-table-test.js @@ -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``); diff --git a/ui/tests/integration/components/copy-button-test.js b/ui/tests/integration/components/copy-button-test.js index 99fc8d1b364..acc4579cf62 100644 --- a/ui/tests/integration/components/copy-button-test.js +++ b/ui/tests/integration/components/copy-button-test.js @@ -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``); 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``); @@ -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``); await click('.copy-button button'); diff --git a/ui/tests/integration/components/das/dismissed-test.js b/ui/tests/integration/components/das/dismissed-test.js index 6f8bf773ea6..c3b4ed74100 100644 --- a/ui/tests/integration/components/das/dismissed-test.js +++ b/ui/tests/integration/components/das/dismissed-test.js @@ -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(); diff --git a/ui/tests/integration/components/das/recommendation-card-test.js b/ui/tests/integration/components/das/recommendation-card-test.js index 301c8a1e88b..73f229bbe67 100644 --- a/ui/tests/integration/components/das/recommendation-card-test.js +++ b/ui/tests/integration/components/das/recommendation-card-test.js @@ -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, diff --git a/ui/tests/integration/components/das/recommendation-chart-test.js b/ui/tests/integration/components/das/recommendation-chart-test.js index 41add8c228e..53b7d6c9e3e 100644 --- a/ui/tests/integration/components/das/recommendation-chart-test.js +++ b/ui/tests/integration/components/das/recommendation-chart-test.js @@ -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); diff --git a/ui/tests/integration/components/flex-masonry-test.js b/ui/tests/integration/components/flex-masonry-test.js index 4380920d90f..a27b64d1e76 100644 --- a/ui/tests/integration/components/flex-masonry-test.js +++ b/ui/tests/integration/components/flex-masonry-test.js @@ -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) }, diff --git a/ui/tests/integration/components/fs/file-test.js b/ui/tests/integration/components/fs/file-test.js index 7ba96935157..29ad9c70377 100644 --- a/ui/tests/integration/components/fs/file-test.js +++ b/ui/tests/integration/components/fs/file-test.js @@ -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); diff --git a/ui/tests/integration/components/gauge-chart-test.js b/ui/tests/integration/components/gauge-chart-test.js index 8ed8ffae635..fb10f5f7a9e 100644 --- a/ui/tests/integration/components/gauge-chart-test.js +++ b/ui/tests/integration/components/gauge-chart-test.js @@ -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); diff --git a/ui/tests/integration/components/image-file-test.js b/ui/tests/integration/components/image-file-test.js index 369747ae289..60f0e68134e 100644 --- a/ui/tests/integration/components/image-file-test.js +++ b/ui/tests/integration/components/image-file-test.js @@ -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); diff --git a/ui/tests/integration/components/job-client-status-bar-test.js b/ui/tests/integration/components/job-client-status-bar-test.js index 47e1dff52ca..b4adac86dc3 100644 --- a/ui/tests/integration/components/job-client-status-bar-test.js +++ b/ui/tests/integration/components/job-client-status-bar-test.js @@ -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); diff --git a/ui/tests/integration/components/job-diff-test.js b/ui/tests/integration/components/job-diff-test.js index 2b9b6f7ddca..dfc1fa403d4 100644 --- a/ui/tests/integration/components/job-diff-test.js +++ b/ui/tests/integration/components/job-diff-test.js @@ -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', diff --git a/ui/tests/integration/components/job-editor-test.js b/ui/tests/integration/components/job-editor-test.js index 23bc9ef9503..aab1e7973d6 100644 --- a/ui/tests/integration/components/job-editor-test.js +++ b/ui/tests/integration/components/job-editor-test.js @@ -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); diff --git a/ui/tests/integration/components/job-page/parts/body-test.js b/ui/tests/integration/components/job-page/parts/body-test.js index 3c03d74e6f5..f61abc69c04 100644 --- a/ui/tests/integration/components/job-page/parts/body-test.js +++ b/ui/tests/integration/components/job-page/parts/body-test.js @@ -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', diff --git a/ui/tests/integration/components/job-page/parts/children-test.js b/ui/tests/integration/components/job-page/parts/children-test.js index c70b409ff52..3c7bb98c92c 100644 --- a/ui/tests/integration/components/job-page/parts/children-test.js +++ b/ui/tests/integration/components/job-page/parts/children-test.js @@ -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, diff --git a/ui/tests/integration/components/job-page/parts/latest-deployment-test.js b/ui/tests/integration/components/job-page/parts/latest-deployment-test.js index 06a99f59451..873ed200ee1 100644 --- a/ui/tests/integration/components/job-page/parts/latest-deployment-test.js +++ b/ui/tests/integration/components/job-page/parts/latest-deployment-test.js @@ -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 }); diff --git a/ui/tests/integration/components/job-page/parts/placement-failures-test.js b/ui/tests/integration/components/job-page/parts/placement-failures-test.js index be83e7f4c9f..7336cff40a1 100644 --- a/ui/tests/integration/components/job-page/parts/placement-failures-test.js +++ b/ui/tests/integration/components/job-page/parts/placement-failures-test.js @@ -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, diff --git a/ui/tests/integration/components/job-page/parts/summary-test.js b/ui/tests/integration/components/job-page/parts/summary-test.js index e9373650b80..dc18a8c3321 100644 --- a/ui/tests/integration/components/job-page/parts/summary-test.js +++ b/ui/tests/integration/components/job-page/parts/summary-test.js @@ -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, }); diff --git a/ui/tests/integration/components/job-page/parts/task-groups-test.js b/ui/tests/integration/components/job-page/parts/task-groups-test.js index b143b95a7f1..0fa42ec1f60 100644 --- a/ui/tests/integration/components/job-page/parts/task-groups-test.js +++ b/ui/tests/integration/components/job-page/parts/task-groups-test.js @@ -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, }); diff --git a/ui/tests/integration/components/job-page/periodic-test.js b/ui/tests/integration/components/job-page/periodic-test.js index 98473239ad4..54df6cd0538 100644 --- a/ui/tests/integration/components/job-page/periodic-test.js +++ b/ui/tests/integration/components/job-page/periodic-test.js @@ -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', { diff --git a/ui/tests/integration/components/job-page/service-test.js b/ui/tests/integration/components/job-page/service-test.js index efc9fe904ed..79160c79093 100644 --- a/ui/tests/integration/components/job-page/service-test.js +++ b/ui/tests/integration/components/job-page/service-test.js @@ -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'); diff --git a/ui/tests/integration/components/lifecycle-chart-test.js b/ui/tests/integration/components/lifecycle-chart-test.js index 22355d5959c..d9ab57a27c6 100644 --- a/ui/tests/integration/components/lifecycle-chart-test.js +++ b/ui/tests/integration/components/lifecycle-chart-test.js @@ -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``); @@ -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 })) diff --git a/ui/tests/integration/components/line-chart-test.js b/ui/tests/integration/components/line-chart-test.js index 3fc239b029b..3e53c036267 100644 --- a/ui/tests/integration/components/line-chart-test.js +++ b/ui/tests/integration/components/line-chart-test.js @@ -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 }, diff --git a/ui/tests/integration/components/list-pagination-test.js b/ui/tests/integration/components/list-pagination-test.js index 14015af1e4f..23d47f8c9bd 100644 --- a/ui/tests/integration/components/list-pagination-test.js +++ b/ui/tests/integration/components/list-pagination-test.js @@ -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` @@ -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, diff --git a/ui/tests/integration/components/list-table-test.js b/ui/tests/integration/components/list-table-test.js index 96711bd71d3..134f4f7d56a 100644 --- a/ui/tests/integration/components/list-table-test.js +++ b/ui/tests/integration/components/list-table-test.js @@ -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', diff --git a/ui/tests/integration/components/multi-select-dropdown-test.js b/ui/tests/integration/components/multi-select-dropdown-test.js index 303630c7b68..1d2f931beca 100644 --- a/ui/tests/integration/components/multi-select-dropdown-test.js +++ b/ui/tests/integration/components/multi-select-dropdown-test.js @@ -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); diff --git a/ui/tests/integration/components/page-layout-test.js b/ui/tests/integration/components/page-layout-test.js index d96df7043c8..59611fd63b0 100644 --- a/ui/tests/integration/components/page-layout-test.js +++ b/ui/tests/integration/components/page-layout-test.js @@ -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``); assert.notOk( diff --git a/ui/tests/integration/components/placement-failure-test.js b/ui/tests/integration/components/placement-failure-test.js index 6bb12b3adc6..0801956f8f6 100644 --- a/ui/tests/integration/components/placement-failure-test.js +++ b/ui/tests/integration/components/placement-failure-test.js @@ -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({ diff --git a/ui/tests/integration/components/plugin-allocation-row-test.js b/ui/tests/integration/components/plugin-allocation-row-test.js index e8df8b3275c..073dff28192 100644 --- a/ui/tests/integration/components/plugin-allocation-row-test.js +++ b/ui/tests/integration/components/plugin-allocation-row-test.js @@ -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, diff --git a/ui/tests/integration/components/popover-menu-test.js b/ui/tests/integration/components/popover-menu-test.js index b0d6b61bc5a..511765cd7ec 100644 --- a/ui/tests/integration/components/popover-menu-test.js +++ b/ui/tests/integration/components/popover-menu-test.js @@ -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); diff --git a/ui/tests/integration/components/primary-metric/allocation-test.js b/ui/tests/integration/components/primary-metric/allocation-test.js index 1f3b122e311..1a50f6f41b9 100644 --- a/ui/tests/integration/components/primary-metric/allocation-test.js +++ b/ui/tests/integration/components/primary-metric/allocation-test.js @@ -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); diff --git a/ui/tests/integration/components/primary-metric/node-test.js b/ui/tests/integration/components/primary-metric/node-test.js index 901e122dbe3..a6d944c3b8f 100644 --- a/ui/tests/integration/components/primary-metric/node-test.js +++ b/ui/tests/integration/components/primary-metric/node-test.js @@ -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); diff --git a/ui/tests/integration/components/primary-metric/primary-metric.js b/ui/tests/integration/components/primary-metric/primary-metric.js index ee118238182..fb91cb20ba0 100644 --- a/ui/tests/integration/components/primary-metric/primary-metric.js +++ b/ui/tests/integration/components/primary-metric/primary-metric.js @@ -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' ); }); diff --git a/ui/tests/integration/components/primary-metric/task-test.js b/ui/tests/integration/components/primary-metric/task-test.js index b388ebb65b8..d77638fac70 100644 --- a/ui/tests/integration/components/primary-metric/task-test.js +++ b/ui/tests/integration/components/primary-metric/task-test.js @@ -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); diff --git a/ui/tests/integration/components/reschedule-event-timeline-test.js b/ui/tests/integration/components/reschedule-event-timeline-test.js index 436a1437bb3..34b8d6b084f 100644 --- a/ui/tests/integration/components/reschedule-event-timeline-test.js +++ b/ui/tests/integration/components/reschedule-event-timeline-test.js @@ -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' diff --git a/ui/tests/integration/components/scale-events-accordion-test.js b/ui/tests/integration/components/scale-events-accordion-test.js index 9c4bbbd77d5..0f3623dd0e2 100644 --- a/ui/tests/integration/components/scale-events-accordion-test.js +++ b/ui/tests/integration/components/scale-events-accordion-test.js @@ -39,6 +39,8 @@ module('Integration | Component | scale-events-accordion', function (hooks) { const commonTemplate = hbs``; 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', diff --git a/ui/tests/integration/components/scale-events-chart-test.js b/ui/tests/integration/components/scale-events-chart-test.js index a6593d3bca3..f0c048eca4a 100644 --- a/ui/tests/integration/components/scale-events-chart-test.js +++ b/ui/tests/integration/components/scale-events-chart-test.js @@ -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``); @@ -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); diff --git a/ui/tests/integration/components/single-select-dropdown-test.js b/ui/tests/integration/components/single-select-dropdown-test.js index ed869e5fe96..cc6d0b37bbc 100644 --- a/ui/tests/integration/components/single-select-dropdown-test.js +++ b/ui/tests/integration/components/single-select-dropdown-test.js @@ -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); diff --git a/ui/tests/integration/components/stepper-input-test.js b/ui/tests/integration/components/stepper-input-test.js index f14273a7f72..fa5c3e144f7 100644 --- a/ui/tests/integration/components/stepper-input-test.js +++ b/ui/tests/integration/components/stepper-input-test.js @@ -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); diff --git a/ui/tests/integration/components/streaming-file-test.js b/ui/tests/integration/components/streaming-file-test.js index 1ce29625e94..31e7b9580de 100644 --- a/ui/tests/integration/components/streaming-file-test.js +++ b/ui/tests/integration/components/streaming-file-test.js @@ -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({ diff --git a/ui/tests/integration/components/task-group-row-test.js b/ui/tests/integration/components/task-group-row-test.js index d5dea832a2f..48f0cd77b9c 100644 --- a/ui/tests/integration/components/task-group-row-test.js +++ b/ui/tests/integration/components/task-group-row-test.js @@ -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(); diff --git a/ui/tests/integration/components/task-log-test.js b/ui/tests/integration/components/task-log-test.js index 6903433ffd1..90c3d41cb9b 100644 --- a/ui/tests/integration/components/task-log-test.js +++ b/ui/tests/integration/components/task-log-test.js @@ -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 diff --git a/ui/tests/integration/components/toggle-test.js b/ui/tests/integration/components/toggle-test.js index e30def50483..e49238f168f 100644 --- a/ui/tests/integration/components/toggle-test.js +++ b/ui/tests/integration/components/toggle-test.js @@ -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); diff --git a/ui/tests/integration/components/topo-viz-test.js b/ui/tests/integration/components/topo-viz-test.js index ca69170edb1..6b25e67524c 100644 --- a/ui/tests/integration/components/topo-viz-test.js +++ b/ui/tests/integration/components/topo-viz-test.js @@ -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)], diff --git a/ui/tests/integration/components/topo-viz/datacenter-test.js b/ui/tests/integration/components/topo-viz/datacenter-test.js index 246a75e73ab..1d6d811195c 100644 --- a/ui/tests/integration/components/topo-viz/datacenter-test.js +++ b/ui/tests/integration/components/topo-viz/datacenter-test.js @@ -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({ diff --git a/ui/tests/integration/components/topo-viz/node-test.js b/ui/tests/integration/components/topo-viz/node-test.js index bad5e32f4f5..54588002dd1 100644 --- a/ui/tests/integration/components/topo-viz/node-test.js +++ b/ui/tests/integration/components/topo-viz/node-test.js @@ -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); diff --git a/ui/tests/integration/components/two-step-button-test.js b/ui/tests/integration/components/two-step-button-test.js index 23ae9584c16..3ef1be602bd 100644 --- a/ui/tests/integration/components/two-step-button-test.js +++ b/ui/tests/integration/components/two-step-button-test.js @@ -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); diff --git a/ui/tests/integration/util/exec-command-editor-xterm-adapter-test.js b/ui/tests/integration/util/exec-command-editor-xterm-adapter-test.js index 24cf2bb27d6..1c132829854 100644 --- a/ui/tests/integration/util/exec-command-editor-xterm-adapter-test.js +++ b/ui/tests/integration/util/exec-command-editor-xterm-adapter-test.js @@ -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` diff --git a/ui/tests/integration/util/exec-socket-xterm-adapter-test.js b/ui/tests/integration/util/exec-socket-xterm-adapter-test.js index d1fb7b70d79..49cdd9b00cb 100644 --- a/ui/tests/integration/util/exec-socket-xterm-adapter-test.js +++ b/ui/tests/integration/util/exec-socket-xterm-adapter-test.js @@ -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(); diff --git a/ui/tests/unit/components/stats-time-series-test.js b/ui/tests/unit/components/stats-time-series-test.js index 76a197be031..0a308a865dd 100644 --- a/ui/tests/unit/components/stats-time-series-test.js +++ b/ui/tests/unit/components/stats-time-series-test.js @@ -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) => { diff --git a/ui/tests/unit/components/topo-viz-test.js b/ui/tests/unit/components/topo-viz-test.js index 09e613bd643..b6a2b82e654 100644 --- a/ui/tests/unit/components/topo-viz-test.js +++ b/ui/tests/unit/components/topo-viz-test.js @@ -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' }), diff --git a/ui/tests/unit/models/task-group-test.js b/ui/tests/unit/models/task-group-test.js index ee086adff0d..091bcd74522 100644 --- a/ui/tests/unit/models/task-group-test.js +++ b/ui/tests/unit/models/task-group-test.js @@ -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(() => diff --git a/ui/tests/unit/models/task-test.js b/ui/tests/unit/models/task-test.js index 16be7f66aa9..67a274bf9ee 100644 --- a/ui/tests/unit/models/task-test.js +++ b/ui/tests/unit/models/task-test.js @@ -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', diff --git a/ui/tests/unit/utils/allocation-stats-tracker-test.js b/ui/tests/unit/utils/allocation-stats-tracker-test.js index ef0133014e2..3c319f0ff25 100644 --- a/ui/tests/unit/utils/allocation-stats-tracker-test.js +++ b/ui/tests/unit/utils/allocation-stats-tracker-test.js @@ -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({ diff --git a/ui/tests/unit/utils/log-test.js b/ui/tests/unit/utils/log-test.js index e1770022d08..920784aa057 100644 --- a/ui/tests/unit/utils/log-test.js +++ b/ui/tests/unit/utils/log-test.js @@ -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);