Sha256: 02e5540709731d1ca712cff4621d29c8e09dc7c6b13341a2708c502baa9a0ecf

Contents?: true

Size: 1.26 KB

Versions: 11

Compression:

Stored size: 1.26 KB

Contents

import React from 'react';
import '@testing-library/jest-dom';
import { render, screen, waitFor } from '@testing-library/react';

import { withMockedProvider, tick } from '../../../testHelper';
import ovalContentQuery from '../../../graphql/queries/ovalContent.gql';
import OvalContentsShow from './';

const TestComponent = withMockedProvider(OvalContentsShow);

const matchMock = { params: { id: 4 } };
const name = 'dotnet OVAL content';
const url =
  'http://oval-content-source/security/data/oval/dotnet-2.2.oval.xml.bz2';
const id = 'MDE6Rm9yZW1hbk9wZW5zY2FwOjpPdmFsQ29udGVudC00';

const mocks = [
  {
    request: {
      query: ovalContentQuery,
      variables: { id },
    },
    result: {
      data: {
        ovalContent: {
          id,
          name,
          url,
          originalFilename: '',
        },
      },
    },
  },
];

describe('OVAL Contents show page', () => {
  it('should show OVAL Content', async () => {
    render(<TestComponent match={matchMock} mocks={mocks} />);
    expect(screen.getByText('Loading')).toBeInTheDocument();
    await waitFor(tick);
    expect(screen.queryByText('Loading')).not.toBeInTheDocument();
    expect(screen.getAllByText(name).length === 2).toBeTruthy();
    expect(screen.getByText(url)).toBeInTheDocument();
  });
});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
foreman_openscap-8.0.0 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js
foreman_openscap-7.1.1 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js
foreman_openscap-7.1.0 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js
foreman_openscap-7.0.0 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js
foreman_openscap-6.0.0 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js
foreman_openscap-5.2.3 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js
foreman_openscap-5.2.2 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js
foreman_openscap-5.1.1 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js
foreman_openscap-5.2.1 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js
foreman_openscap-5.2.0 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js
foreman_openscap-5.1.0 webpack/routes/OvalContents/OvalContentsShow/OvalContentsShow.test.js