From 79769779b2b5fb108338bccac4f11c2810d82e12 Mon Sep 17 00:00:00 2001 From: Daniel Bisgrove Date: Tue, 10 Dec 2024 07:12:48 -0500 Subject: [PATCH] renaming canDelete variable --- .../DeleteContactModal/DeleteContactModal.test.tsx | 10 +++++++--- .../DeleteContactModal/DeleteContactModal.tsx | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/Contacts/ContactDetails/ContactDetailsHeader/DeleteContactModal/DeleteContactModal.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsHeader/DeleteContactModal/DeleteContactModal.test.tsx index 222d304e2..b93a5b795 100644 --- a/src/components/Contacts/ContactDetails/ContactDetailsHeader/DeleteContactModal/DeleteContactModal.test.tsx +++ b/src/components/Contacts/ContactDetails/ContactDetailsHeader/DeleteContactModal/DeleteContactModal.test.tsx @@ -120,7 +120,7 @@ describe('DeleteContactModal', () => { expect(getByRole('button', { name: 'delete contact' })).toBeDisabled(); }); - describe('Disable deletion', () => { + describe('Show third party message', () => { interface TestProps { testName: string; props: TestComponentProps; @@ -156,17 +156,21 @@ describe('DeleteContactModal', () => { ]; test.each(tests)('$testName', async ({ props }) => { - const { findByText } = render(); + const { findByText, getByRole } = render(); expect( await findByText( /its data may sync with Donation Services or other third-party systems/, ), ).toBeInTheDocument(); + + expect( + getByRole('button', { name: 'delete contact' }), + ).toBeInTheDocument(); }); }); - describe('Enable deletion', () => { + describe('Show normal delete message', () => { it('should show modal and be able to delete user', async () => { const { getByText, getByRole } = render( ({ })); interface DataInfo { - canDelete: boolean; + canDeleteWithoutIssues: boolean; contactSource: string; addressSources: string[]; emailSources: string[]; @@ -59,7 +59,7 @@ export const DeleteContactModal: React.FC = ({ const dataInfo: DataInfo = useMemo(() => { if (!contactSources) { return { - canDelete: true, + canDeleteWithoutIssues: true, contactSource: sourceToStr(t, 'MPDX'), addressSources: [], emailSources: [], @@ -96,7 +96,7 @@ export const DeleteContactModal: React.FC = ({ }); return { - canDelete: + canDeleteWithoutIssues: isEditableSource(contactSources.source ?? '') && !addressSources.size && !emailSources.size && @@ -117,7 +117,7 @@ export const DeleteContactModal: React.FC = ({ handleClose={() => setOpen(false)} > - {dataInfo.canDelete ? ( + {dataInfo.canDeleteWithoutIssues ? ( {t( `Are you sure you want to permanently delete this contact? Doing so will permanently delete this contacts information, as well as task history. This cannot be undone. If you wish to keep this information, you can try hiding this contact instead.`,