Revision 0fc33e91
Added by John Mitsch almost 6 years ago
webpack/scenes/Subscriptions/__tests__/SubscriptionsTable.test.js | ||
---|---|---|
import React from 'react';
|
||
import { render } from 'enzyme';
|
||
import toJson from 'enzyme-to-json';
|
||
import { MemoryRouter } from 'react-router-dom';
|
||
import SubscriptionsTable from '../SubscriptionsTable';
|
||
import { successState, loadingState, emptyState } from './subscriptions.fixtures';
|
||
import { loadSubscriptions, updateQuantity } from '../SubscriptionActions';
|
||
|
||
describe('subscriptions table', () => {
|
||
it('should render a table', async () => {
|
||
const page = render(<SubscriptionsTable
|
||
subscriptions={successState}
|
||
loadSubscriptions={loadSubscriptions}
|
||
updateQuantity={updateQuantity}
|
||
subscriptionDeleteModalOpen={false}
|
||
onSubscriptionDeleteModalClose={() => { }}
|
||
onDeleteSubscriptions={() => {}}
|
||
toggleDeleteButton={() => {}}
|
||
/>);
|
||
// Wrapping SubscriptionTable in MemoryRouter here since it contains
|
||
// a Link componenent, which can't be used outside a Router
|
||
/* eslint-disable react/jsx-indent */
|
||
const page = render(<MemoryRouter>
|
||
<SubscriptionsTable
|
||
subscriptions={successState}
|
||
loadSubscriptions={loadSubscriptions}
|
||
updateQuantity={updateQuantity}
|
||
subscriptionDeleteModalOpen={false}
|
||
onSubscriptionDeleteModalClose={() => { }}
|
||
onDeleteSubscriptions={() => {}}
|
||
toggleDeleteButton={() => {}}
|
||
/>
|
||
</MemoryRouter>);
|
||
expect(toJson(page)).toMatchSnapshot();
|
||
});
|
||
/* eslint-enable react/jsx-indent */
|
||
|
||
it('should render an empty state', async () => {
|
||
const page = render(<SubscriptionsTable
|
Also available in: Unified diff
Fixes #23687 - Adds subscription details page
This rewrites the subscription details page in React. Links in the
main subs table will used this page. There will be a follow-up change
for the Product Content tab.