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