Sha256: f400bc908d4d42a72096f625a8be14d596f9856aa859445530fc33d597eef1e0

Contents?: true

Size: 1.68 KB

Versions: 4

Compression:

Stored size: 1.68 KB

Contents

import React from 'react';
import { render } from 'react-testing-lib-wrapper';
import ErrataOverviewCard from '../ErrataOverviewCard';
import nock from '../../../../../test-utils/nockWrapper';

describe('Without errata', () => {
  afterEach(() => {
    nock.cleanAll();
  });

  test('does not show piechart when there are 0 errata', () => {
    const hostDetails = {
      id: 2,
      content_facet_attributes: {
        errata_counts: {
          bugfix: 0,
          enhancement: 0,
          security: 0,
          total: 0,
        },
      },
    };
    /* eslint-disable max-len */
    const { queryByLabelText, getByText } = render(<ErrataOverviewCard hostDetails={hostDetails} />);
    /* eslint-enable max-len */
    expect(queryByLabelText('errataChart')).not.toBeInTheDocument();
    expect(getByText('0 errata')).toBeInTheDocument();
  });
});

describe('With errata', () => {
  afterEach(() => {
    nock.cleanAll();
  });

  test('show piechart when there are errata', () => {
    const hostDetails = {
      id: 2,
      content_facet_attributes: {
        errata_counts: {
          bugfix: 10,
          enhancement: 20,
          security: 30,
          total: 60,
        },
      },
    };
    const { getByText, container } = render(<ErrataOverviewCard hostDetails={hostDetails} />);
    expect(container.getElementsByClassName('erratachart')).toHaveLength(1);
    expect(container.getElementsByClassName('erratalegend')).toHaveLength(1);
    expect(getByText('60 errata')).toBeInTheDocument();
    expect(getByText('30 security advisories')).toBeInTheDocument();
    expect(getByText('10 bug fixes')).toBeInTheDocument();
    expect(getByText('20 enhancements')).toBeInTheDocument();
  });
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
katello-4.3.1 webpack/components/extensions/HostDetails/Cards/__tests__/errataOverviewCard.test.js
katello-4.4.0.rc2 webpack/components/extensions/HostDetails/Cards/__tests__/errataOverviewCard.test.js
katello-4.4.0.rc1 webpack/components/extensions/HostDetails/Cards/__tests__/errataOverviewCard.test.js
katello-4.3.0 webpack/components/extensions/HostDetails/Cards/__tests__/errataOverviewCard.test.js