Sha256: 2d45b2a579ea8f08402df60d81998d01fcf662dfd4a6ccde74b18253db878f4a

Contents?: true

Size: 1.53 KB

Versions: 44

Compression:

Stored size: 1.53 KB

Contents

import React from 'react';
import { shallow } from '@theforeman/test';
import AggregateStatus from './index';

jest.unmock('./index.js');

describe('AggregateStatus', () => {
  describe('has no data', () => {
    it('renders cards with no data', () => {
      const chartNumbers = shallow(
        <AggregateStatus statuses={{}} chartFilter={_x => {}} />
      );
      const success = chartNumbers.find('#success_count').text();
      const failed = chartNumbers.find('#failed_count').text();
      const pending = chartNumbers.find('#pending_count').text();
      const cancelled = chartNumbers.find('#cancelled_count').text();
      expect(success).toBe('');
      expect(failed).toBe('');
      expect(cancelled).toBe('');
      expect(pending).toBe('');
    });

    it('renders cards with props passed', () => {
      const statuses = {
        success: 19,
        failed: 20,
        cancelled: 31,
        pending: 3,
      };
      const chartNumbers = shallow(
        <AggregateStatus statuses={statuses} chartFilter={_x => {}} />
      );
      const success = chartNumbers.find('#success_count').text();
      const failed = chartNumbers.find('#failed_count').text();
      const pending = chartNumbers.find('#pending_count').text();
      const cancelled = chartNumbers.find('#cancelled_count').text();
      expect(success).toBe(statuses.success.toString());
      expect(failed).toBe(statuses.failed.toString());
      expect(cancelled).toBe(statuses.cancelled.toString());
      expect(pending).toBe(statuses.pending.toString());
    });
  });
});

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
foreman_remote_execution-8.2.1 webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js
foreman_remote_execution-8.2.0 webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js
foreman_remote_execution-9.0.1 webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js
foreman_remote_execution-9.0.0 webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js