Skip to content

Instantly share code, notes, and snippets.

@dereknahman
Created May 9, 2022 15:21
Show Gist options
  • Save dereknahman/dac1891efc302b31f0921bfc0c47178a to your computer and use it in GitHub Desktop.
Save dereknahman/dac1891efc302b31f0921bfc0c47178a to your computer and use it in GitHub Desktop.
import React from 'react';
import { render, screen } from '../../utils/test-utils';
import CommissionView from '.';
const mocks = {
clearCommission: jest.fn(),
dispatchCommission: jest.fn(),
overlayRealign: jest.fn(),
getDeskName: jest.fn('000000000000000000000000'),
};
const approvalsState = {
approve: jest.fn(),
decline: jest.fn(),
errorMessage: '',
};
const setIsEditPaymentMode = jest.fn();
afterEach(() => {
jest.clearAllMocks();
});
describe('CommissionView', () => {
const getCommissionState = (overrides) => ({
commissionState: {
commission: {
contributor: {
firstName: '',
lastName: '',
_id: '000000000000000000000000',
},
deskId: mocks.getDeskName,
plannedPublishDate: '2022-05-06T15:40:00.000Z',
publishedDate: '2022-05-04T14:06:15.691Z',
articleId: '00000000-0000-0000-0000-000000000000',
title: 'Testing',
...overrides,
},
},
commissionOverlayState: {
overlay: {
realign: () => mocks.overlayRealign,
},
},
dispatchCommission: mocks.dispatchCommission,
clearCommission: mocks.clearCommission,
});
beforeEach(() => {
const providerProps = {
commissionState: getCommissionState({}),
};
render(
<CommissionView
approvalsState={approvalsState}
setIsEditPaymentMode={setIsEditPaymentMode}
/>,
{
providerProps,
}
);
});
it('plannedPublishDate and pulishedDate should update when Article UUID is updated', () => {
expect(screen.getByText('Testing')).toBeInTheDocument();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment