Skip to content

Commit

Permalink
Allow the next increase ask to be removed from the partner info
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-bizz committed Dec 11, 2024
1 parent dbfb393 commit 395cb54
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -703,4 +703,35 @@ describe('EditPartnershipInfoModal', () => {
);
expect(handleClose).toHaveBeenCalled();
});

it('should allow user to remove next ask date', async () => {
const mutationSpy = jest.fn();
const { getByLabelText, getByText, findByText } = render(
<SnackbarProvider>
<LocalizationProvider dateAdapter={AdapterLuxon}>
<ThemeProvider theme={theme}>
<GqlMockedProvider onCall={mutationSpy}>
<EditPartnershipInfoModal
contact={contactMock}
handleClose={handleClose}
/>
</GqlMockedProvider>
</ThemeProvider>
</LocalizationProvider>
</SnackbarProvider>,
);
const datePickerButton = getByLabelText('Next Increase Ask');
userEvent.click(datePickerButton);
const clearButton = await findByText('Clear');
userEvent.click(clearButton);
userEvent.click(getByText('Save'));

await waitFor(() =>
expect(mutationSpy).toHaveGraphqlOperation('UpdateContactPartnership', {
attributes: {
nextAsk: null,
},
}),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const EditPartnershipInfoModal: React.FC<
attributes: {
...attributes,
pledgeStartDate: attributes.pledgeStartDate?.toISODate(),
nextAsk: attributes.nextAsk?.toISODate(),
nextAsk: attributes.nextAsk?.toISODate() ?? null,
primaryPersonId: attributes.primaryPersonId,
},
},
Expand Down

0 comments on commit 395cb54

Please sign in to comment.