diff --git a/src/components/Tool/FixMailingAddresses/Contact.tsx b/src/components/Tool/FixMailingAddresses/Contact.tsx index 376b5db2b..1341fb177 100644 --- a/src/components/Tool/FixMailingAddresses/Contact.tsx +++ b/src/components/Tool/FixMailingAddresses/Contact.tsx @@ -42,7 +42,6 @@ import { HandleSingleConfirmProps, emptyAddress } from './FixMailingAddresses'; import { ContactAddressFragment } from './GetInvalidAddresses.generated'; const ContactHeader = styled(CardHeader)(() => ({ - cursor: 'pointer', '.MuiCardHeader-action': { alignSelf: 'center', }, diff --git a/src/components/Tool/FixMailingAddresses/FixMailingAddresses.test.tsx b/src/components/Tool/FixMailingAddresses/FixMailingAddresses.test.tsx index 46f00fa74..c434631d5 100644 --- a/src/components/Tool/FixMailingAddresses/FixMailingAddresses.test.tsx +++ b/src/components/Tool/FixMailingAddresses/FixMailingAddresses.test.tsx @@ -430,7 +430,7 @@ describe('FixSendNewsletter', () => { describe('handleSingleConfirm()', () => { it('should fire handleSingleConfirm', async () => { - const { getAllByRole, getByText, queryByTestId } = render( + const { getAllByRole, getByText, queryByTestId, queryByText } = render( { const name = 'Baggins, Frodo'; await waitFor(() => expect(getByText(name)).toBeInTheDocument()); - // TODO: Fix when GraphQL is fixed - await waitFor(() => - expect(mockEnqueue).toHaveBeenCalledWith( - `${name} - Error while saving addresses. undefined`, - { - variant: 'error', - }, - ), - ); - - // await waitFor(() => - // expect(queryByText(name)).not.toBeInTheDocument(), - // ); + await waitFor(() => { + expect(mockEnqueue).toHaveBeenCalledWith(`Updated contact ${name}`, { + variant: 'success', + }); + expect(queryByText(name)).not.toBeInTheDocument(); + }); }); }); describe('handleBulkConfirm()', () => { it('should fire handleSingleConfirm', async () => { process.env.APP_NAME = 'MPDX'; - const { getByRole, queryByTestId } = render( + const name1 = 'Baggins, Frodo'; + const name2 = 'Gamgee, Samwise'; + const { getByRole, queryByTestId, queryByText } = render( , @@ -478,7 +492,7 @@ describe('FixSendNewsletter', () => { await waitFor(() => expect(queryByTestId('loading')).not.toBeInTheDocument(), ); - userEvent.click(getByRole('button', { name: 'Confirm 1 as MPDX' })); + userEvent.click(getByRole('button', { name: 'Confirm 2 as MPDX' })); await waitFor(() => expect(getByRole('heading', { name: 'Confirm' })).toBeInTheDocument(), @@ -486,33 +500,23 @@ describe('FixSendNewsletter', () => { userEvent.click(getByRole('button', { name: 'Yes' })); - // TODO: Fix when GraphQL is fixed - const name = 'Baggins, Frodo'; await waitFor(() => { - expect(mockEnqueue).toHaveBeenCalledWith( - `Error updating contact ${name}`, - { - variant: 'error', - autoHideDuration: 7000, - }, - ); - expect(mockEnqueue).toHaveBeenCalledWith( - `Error when updating 1 contact(s)`, - { - variant: 'error', - }, - ); - }); + expect(mockEnqueue).toHaveBeenCalledWith(`Updated contact ${name1}`, { + variant: 'success', + }); + expect(mockEnqueue).toHaveBeenCalledWith(`Updated contact ${name2}`, { + variant: 'success', + }); - // await waitFor(() => - // expect(queryByText(name)).not.toBeInTheDocument(), - // ); + expect(queryByText(name1)).not.toBeInTheDocument(); + expect(queryByText(name2)).not.toBeInTheDocument(); + }); }); }); it('should fire handleSingleConfirm', async () => { process.env.APP_NAME = 'MPDX'; - const { getByRole, queryByTestId } = render( + const { getByRole, queryByTestId, queryByText } = render( { userEvent.click(getByRole('button', { name: 'Yes' })); - // TODO: Fix when GraphQL is fixed await waitFor(() => { - expect(mockEnqueue).toHaveBeenCalledWith( - `Error updating contact ${name}`, - { - variant: 'error', - autoHideDuration: 7000, - }, - ); - expect(mockEnqueue).toHaveBeenCalledWith( - `Error when updating 1 contact(s)`, - { - variant: 'error', - }, - ); + expect(mockEnqueue).toHaveBeenCalledWith(`Updated contact ${name}`, { + variant: 'success', + }); + expect(queryByText(name)).not.toBeInTheDocument(); }); - - // await waitFor(() => - // expect(queryByText(name)).not.toBeInTheDocument(), - // ); }); }); diff --git a/src/components/Tool/FixMailingAddresses/FixMailingAddresses.tsx b/src/components/Tool/FixMailingAddresses/FixMailingAddresses.tsx index 0c5cf5e67..e738f529d 100644 --- a/src/components/Tool/FixMailingAddresses/FixMailingAddresses.tsx +++ b/src/components/Tool/FixMailingAddresses/FixMailingAddresses.tsx @@ -166,9 +166,6 @@ const FixSendNewsletter: React.FC = ({ attributes: { id: address.id, validValues: true, - // TODO: Fix the Graph QL Input - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore primaryMailingAddress: address.primaryMailingAddress, }, },