github.com/hernad/nomad@v1.6.112/ui/tests/integration/components/service-status-bar-test.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import { findAll, render } from '@ember/test-helpers';
     7  import { setupRenderingTest } from 'ember-qunit';
     8  import hbs from 'htmlbars-inline-precompile';
     9  import { module, test } from 'qunit';
    10  import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
    11  
    12  module('Integration | Component | Service Status Bar', function (hooks) {
    13    setupRenderingTest(hooks);
    14  
    15    test('Visualizes aggregate status of a service', async function (assert) {
    16      assert.expect(2);
    17      const component = this;
    18      await componentA11yAudit(component, assert);
    19  
    20      const serviceStatus = {
    21        success: 1,
    22        pending: 1,
    23        failure: 1,
    24      };
    25  
    26      this.set('serviceStatus', serviceStatus);
    27  
    28      await render(hbs`
    29        <div class="inline-chart">
    30          <ServiceStatusBar
    31            @status={{this.serviceStatus}}
    32            @name="peter"
    33          />
    34        </div>
    35      `);
    36  
    37      const bars = findAll('g > g').length;
    38  
    39      assert.equal(bars, 3, 'It visualizes services by status');
    40    });
    41  });