Sha256: 610da57fdfbed57acf6af7f8329331204dd720610ced991f45758d6a3dbdc21b

Contents?: true

Size: 1.34 KB

Versions: 33

Compression:

Stored size: 1.34 KB

Contents

import React from 'react';
import thunk from 'redux-thunk';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import configureMockStore from 'redux-mock-store';
import RepositorySetRepositories from '../RepositorySetRepositories';

const mockStore = configureMockStore([thunk]);
const store = mockStore({ katello: { redHatRepositories: { repositorySetRepositories: [] } } });

describe('RepositorySetRepositories Component', () => {
  let shallowWrapper;
  beforeEach(() => {
    shallowWrapper = shallow(<RepositorySetRepositories
      store={store}
      contentId={1}
      productId={2}
      type="foo"
    />);
  });

  it('sorts repos correctly', async () => {
    const repos = [
      { arch: 'x86_64', releasever: '5.11' },
      { arch: 'x86_64', releasever: '7Server' },
      { arch: 'x86_64', releasever: '7.10' },
      { arch: 'x86_64', releasever: '7.1' },
      { arch: 'i386', releasever: '5.11' },
      { arch: 'i386', releasever: '5Workstation' },
      { arch: 'x86_64', releasever: '7.11' }];

    const result = shallowWrapper.dive().instance().sortedRepos(repos);

    const expectedIndices = [1, 5, 6, 2, 3, 0, 4];

    expectedIndices.forEach((expected, i) => {
      expect(result[i]).toEqual(repos[expected]);
    });
  });

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

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
katello-3.14.1 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.13.4 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.14.0 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.13.3 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.14.0.rc2 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.13.2 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.14.0.rc1 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.13.1 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.13.0 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.13.0.rc2.1 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.13.0.rc2 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.12.3 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.12.2 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.13.0.rc1 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.12.1 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.11.2 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.10.2 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.12.0 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.12.0.rc2 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js
katello-3.10.1.1 webpack/scenes/RedHatRepositories/components/__tests__/RepositorySetRepositories.test.js