github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/tests/integration/components/service-status-bar-test.js (about)

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