Sha256: 23928987f4822459c778a2c072d726be28a0cc11202130bd1da5432dbf7c758f

Contents?: true

Size: 1.94 KB

Versions: 8

Compression:

Stored size: 1.94 KB

Contents

import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import { loadSetting } from 'foremanReact/components/Settings/SettingsActions';
import SubscriptionsPage from '../SubscriptionsPage';
import { successState, settingsSuccessState } from './subscriptions.fixtures';
import { loadSubscriptions, updateQuantity, loadTableColumns } from '../SubscriptionActions';
import { createColumns, updateColumns } from '../../../scenes/Settings/Tables/TableActions';

jest.mock('foremanReact/components/Pagination/PaginationWrapper', () => (<div>Pagination Mock</div>));

const loadTables = () => new Promise((resolve) => {
  resolve();
});

describe('subscriptions page', () => {
  const noop = () => {};
  const organization = { owner_details: { upstreamConsumer: 'blah' } };
  const page = shallow(<SubscriptionsPage
    organization={organization}
    subscriptions={successState}
    subscriptionTableSettings={settingsSuccessState}
    loadSetting={loadSetting}
    loadTables={loadTables}
    loadTableColumns={loadTableColumns}
    createColumns={createColumns}
    updateColumns={updateColumns}
    loadSubscriptions={loadSubscriptions}
    updateQuantity={updateQuantity}
    pollTaskUntilDone={noop}
    pollBulkSearch={noop}
    deleteSubscriptions={() => {}}
    resetTasks={noop}
    uploadManifest={noop}
    deleteManifest={noop}
    refreshManifest={noop}
    updateSearchQuery={noop}
    openManageManifestModal={noop}
    closeManageManifestModal={noop}
    openDeleteModal={noop}
    closeDeleteModal={noop}
    openTaskModal={noop}
    closeTaskModal={noop}
    disableDeleteButton={noop}
    enableDeleteButton={noop}
  />);

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

  it('should poll tasks when org changes', async () => {
    jest.spyOn(page.instance(), 'pollTasks');

    page.setProps({ organization: { id: 1 } });

    expect(page.instance().pollTasks).toHaveBeenCalled();
  });
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
katello-3.13.4 webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js
katello-3.13.3 webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js
katello-3.13.2 webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js
katello-3.13.1 webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js
katello-3.13.0 webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js
katello-3.13.0.rc2.1 webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js
katello-3.13.0.rc2 webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js
katello-3.13.0.rc1 webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js