diff --git a/src/components/Reports/PartnerGivingAnalysisReport/PartnerGivingAnalysisReport.test.tsx b/src/components/Reports/PartnerGivingAnalysisReport/PartnerGivingAnalysisReport.test.tsx index 0f955ad14..cf056f278 100644 --- a/src/components/Reports/PartnerGivingAnalysisReport/PartnerGivingAnalysisReport.test.tsx +++ b/src/components/Reports/PartnerGivingAnalysisReport/PartnerGivingAnalysisReport.test.tsx @@ -3,7 +3,10 @@ import { ThemeProvider } from '@mui/material/styles'; import { render, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { GqlMockedProvider } from '__tests__/util/graphqlMocking'; -import { GetPartnerGivingAnalysisIdsForMassSelectionQuery } from 'src/hooks/GetIdsForMassSelection.generated'; +import { + GetPartnerGivingAnalysisIdsForMassSelectionQuery, + GetTaskIdsForMassSelectionQuery, +} from 'src/hooks/GetIdsForMassSelection.generated'; import theme from 'src/theme'; import { PartnerGivingAnalysisReport, @@ -204,15 +207,17 @@ const mocks: Mocks = { GetPartnerGivingAnalysisIdsForMassSelection: { partnerGivingAnalysisReport: { contacts: [ - { - id: '01', - }, - { - id: '02', - }, - { - id: '03', - }, + { id: '01' }, + { id: '02' }, + { id: '03' }, + { id: '04' }, + { id: '05' }, + { id: '06' }, + { id: '07' }, + { id: '08' }, + { id: '09' }, + { id: '10' }, + { id: '11' }, ], }, }, @@ -447,6 +452,7 @@ describe('PartnerGivingAnalysisReport', () => { mocks={mocks} > diff --git a/src/components/Tool/Appeal/Modals/DeleteAppealContact/DeleteAppealContactModal.test.tsx b/src/components/Tool/Appeal/Modals/DeleteAppealContact/DeleteAppealContactModal.test.tsx index 988c182cd..c10b8f584 100644 --- a/src/components/Tool/Appeal/Modals/DeleteAppealContact/DeleteAppealContactModal.test.tsx +++ b/src/components/Tool/Appeal/Modals/DeleteAppealContact/DeleteAppealContactModal.test.tsx @@ -83,7 +83,7 @@ const Components = ({ viewMode = TableViewModeEnum.List }: ComponentsProps) => { ], pageInfo: { hasNextPage: true, - endCursor: 'endCursor', + endCursor: `endCursor${requestCount}`, }, }, }; @@ -112,7 +112,7 @@ const Components = ({ viewMode = TableViewModeEnum.List }: ComponentsProps) => { ], pageInfo: { hasNextPage: false, - endCursor: 'endCursor', + endCursor: 'endCursor3', }, }, }; @@ -120,6 +120,18 @@ const Components = ({ viewMode = TableViewModeEnum.List }: ComponentsProps) => { requestCount++; return mutationResponse; }, + GetContactIdsForMassSelection: { + contacts: { + nodes: [ + { id: '01' }, + { id: '02' }, + { id: '03' }, + { id: '04' }, + { id: '05' }, + { id: '06' }, + ], + }, + }, }} onCall={mutationSpy} > @@ -179,25 +191,21 @@ describe('DeleteAppealContactModal', () => { it('fetches all the appealContacts and matches up the correct ID to send to the API', async () => { const { getByRole } = render(); - expect(mutationSpy).toHaveBeenCalledTimes(0); - - await waitFor(() => { - expect(mutationSpy).toHaveBeenCalledTimes(8); - }); - - // Call AppealContacts 4 times getting all contacts. - expect(mutationSpy.mock.calls[0][0].operation.operationName).toEqual( - 'AppealContacts', - ); - expect(mutationSpy.mock.calls[1][0].operation.operationName).toEqual( - 'AppealContacts', - ); - expect(mutationSpy.mock.calls[5][0].operation.operationName).toEqual( - 'AppealContacts', - ); - expect(mutationSpy.mock.calls[6][0].operation.operationName).toEqual( - 'AppealContacts', + // Call AppealContacts 3 times getting all contacts. + await waitFor(() => + expect(mutationSpy).toHaveGraphqlOperation('AppealContacts', { + after: 'endCursor2', + appealId: 'appealId', + }), ); + expect(mutationSpy).toHaveGraphqlOperation('AppealContacts', { + after: null, + appealId: 'appealId', + }); + expect(mutationSpy).toHaveGraphqlOperation('AppealContacts', { + after: 'endCursor1', + appealId: 'appealId', + }); userEvent.click(getByRole('button', { name: 'Yes' })); diff --git a/src/components/Tool/Appeal/Modals/DeleteAppealContact/DeleteAppealContactModal.tsx b/src/components/Tool/Appeal/Modals/DeleteAppealContact/DeleteAppealContactModal.tsx index 74e40d945..118443c97 100644 --- a/src/components/Tool/Appeal/Modals/DeleteAppealContact/DeleteAppealContactModal.tsx +++ b/src/components/Tool/Appeal/Modals/DeleteAppealContact/DeleteAppealContactModal.tsx @@ -62,9 +62,7 @@ export const DeleteAppealContactModal: React.FC< while (hasNextPage) { const response = await fetchMore({ variables: { - appealId: appealId, after: cursor, - first: 100, }, });