Sha256: 164403b87cbfe2855be6cdcade03b2178178f999017dfab2516b2e52c91792cb

Contents?: true

Size: 1.35 KB

Versions: 87

Compression:

Stored size: 1.35 KB

Contents

import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import RedHatRepositoriesPage from '../RedHatRepositoriesPage';

jest.mock('foremanReact/components/PermissionDenied');

describe('RedHatRepositories page', () => {
  const page = shallow(<RedHatRepositoriesPage
    loadEnabledRepos={jest.fn()}
    loadRepositorySets={jest.fn()}
    updateRecommendedRepositorySets={jest.fn()}
    enabledRepositories={{
      loading: false,
      search: {},
      missingPermissions: [],
      repositories: [],
    }}
    repositorySets={{
      recommended: false,
      loading: false,
      search: {},
      missingPermissions: [],
    }}
  />);

  const permissionDeniedPage = shallow(<RedHatRepositoriesPage
    loadEnabledRepos={jest.fn()}
    loadRepositorySets={jest.fn()}
    updateRecommendedRepositorySets={jest.fn()}
    enabledRepositories={{
      loading: false,
      search: {},
      missingPermissions: ['view_organizations'],
    }}
    repositorySets={{
      recommended: false,
      loading: false,
      search: {},
      missingPermissions: ['view_organizations'],
    }}
  />);

  it('should render', async () => {
    expect(toJson(page)).toMatchSnapshot();
  });

  it('should render <PermissionDenied /> when permissions are missing', async () => {
    expect(toJson(permissionDeniedPage)).toMatchSnapshot();
  });
});

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
katello-4.3.1 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.2.2 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.3.0 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.3.0.rc4 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.3.0.rc3 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.3.0.rc2.1 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.3.0.rc2 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.3.0.rc1 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.2.1 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.2.0.1 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.1.4 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.0.3 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.2.0.1.rc3 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-3.18.5 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.2.0.1.rc2 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.2.0.rc2 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.1.3 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.2.0.rc1 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.0.2.1 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js
katello-4.1.2.1 webpack/scenes/RedHatRepositories/__tests__/RedHatRepositoriesPage.test.js