Skip to content

Commit

Permalink
Updates enqueueSnackbar message, and subsequent test.
Browse files Browse the repository at this point in the history
  • Loading branch information
wjames111 committed Aug 21, 2024
1 parent 15d463d commit 0781cfe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
3 changes: 1 addition & 2 deletions src/components/Tool/FixPhoneNumbers/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ interface Props {
values: FormValues,
personId: string,
personIndex: number,
name: string,
) => void;
errors: FormikErrors<any>;
setValues: (values: FormValues) => void;
Expand Down Expand Up @@ -188,7 +187,7 @@ const Contact: React.FC<Props> = ({
<Button
data-testid={`confirmButton-${person.id}`}
onClick={() =>
handleUpdate(values, person.id, personIndex, name)
handleUpdate(values, person.id, personIndex)
}
variant="contained"
style={{ width: '100%' }}
Expand Down
9 changes: 3 additions & 6 deletions src/components/Tool/FixPhoneNumbers/FixPhoneNumbers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,9 @@ describe('FixPhoneNumbers-Home', () => {

userEvent.click(getByTestId('confirmButton-testid'));
await waitFor(() => {
expect(mockEnqueue).toHaveBeenCalledWith(
"Test Contact's phone numbers updated!",
{
variant: 'success',
},
);
expect(mockEnqueue).toHaveBeenCalledWith('Phone numbers updated!', {
variant: 'success',
});
});
});
it('should bulk confirm all phone numbers', async () => {
Expand Down
13 changes: 6 additions & 7 deletions src/components/Tool/FixPhoneNumbers/FixPhoneNumbers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ const FixPhoneNumbers: React.FC<Props> = ({
});
},
onError: () => {
enqueueSnackbar(t(`Error updating phone numbers`), {
enqueueSnackbar(t('Error updating phone numbers'), {
variant: 'error',
});
},
onCompleted: () => {
enqueueSnackbar(t(`Phone numbers updated!`), {
enqueueSnackbar(t('Phone numbers updated!'), {
variant: 'success',
});
},
Expand All @@ -205,7 +205,6 @@ const FixPhoneNumbers: React.FC<Props> = ({
values: FormValues,
personId: string,
personIndex: number,
name: string,
): Promise<void> => {
const attributes = [
{
Expand All @@ -231,13 +230,13 @@ const FixPhoneNumbers: React.FC<Props> = ({
update: (cache) => {
cache.evict({ id: `Person:${personId}` });
},
onError() {
enqueueSnackbar(t(`Error updating ${name}'s phone numbers`), {
onError: () => {
enqueueSnackbar(t('Error updating phone numbers'), {
variant: 'error',
});
},
onCompleted() {
enqueueSnackbar(t(`${name}'s phone numbers updated!`), {
onCompleted: () => {
enqueueSnackbar(t('Phone numbers updated!'), {
variant: 'success',
});
},
Expand Down

0 comments on commit 0781cfe

Please sign in to comment.