Skip to content

Commit

Permalink
Fix grammar on the error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mutuajames committed Jul 24, 2023
1 parent a08c7a2 commit cc359ac
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ describe('components/DownloadClientData/utils/submitForm', () => {
expect(setSubmittingMock.mock.calls[1][0]).toEqual(false);
expect(papaparseMock).not.toHaveBeenCalled();
expect(notificationErrorMock).toHaveBeenCalledWith(
'There was a problem submitting download client data form'
'There was a problem submitting the data form'
);
});

Expand Down Expand Up @@ -293,7 +293,7 @@ describe('components/DownloadClientData/utils/submitForm', () => {
expect(setSubmittingMock.mock.calls[1][0]).toEqual(false);
expect(papaparseMock).not.toHaveBeenCalled();
expect(notificationErrorMock).toHaveBeenCalledWith(
'There was a problem submitting download client data form'
'There was a problem submitting the data form'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const submitForm = async (
})
.catch((_: Error) => {
setSubmitting(false);
sendErrorNotification(t('There was a problem submitting download client data form'));
sendErrorNotification(t('There was a problem submitting the data form'));
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ const CareTeamForm: React.FC<CareTeamFormProps> = (props: CareTeamFormProps) =>
submitForm(values, initialValues, fhirBaseURL, organizations, practitioners, t)
.catch(() => {
if (initialValues.id) {
sendErrorNotification(t('There was a problem updating Care Team'));
sendErrorNotification(t('There was a problem updating the Care Team'));
} else {
sendErrorNotification(t('There was a problem creating Care Team'));
sendErrorNotification(t('There was a problem creating the Care Team'));
}
})
.finally(() => setIsSubmitting(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const CreateEditCareTeam: React.FC<CreateEditCareTeamProps> = (props: CreateEdit
[FHIR_CARE_TEAM, careTeamId],
async () => await new FHIRServiceClass(fhirBaseURL, FHIR_CARE_TEAM).read(careTeamId as string),
{
onError: () => sendErrorNotification(t('There was a problem fetching Care Team')),
onError: () => sendErrorNotification(t('There was a problem fetching the Care Team')),
select: (res) => res,
enabled: !!careTeamId,
cacheTime: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const submitForm = async (
// TODO - possible place to use translation plurals
.then(() => sendSuccessNotification(successNotificationMessage))
.catch(() => {
sendErrorNotification(t('There was a problem fetching Care Team'));
sendErrorNotification(t('There was a problem fetching the Care Team'));
})
.finally(() => history.push(URL_CARE_TEAM));
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ const DrafFileList = (props: DraftFileListProps): JSX.Element => {
OPENSRP_MANIFEST_ENDPOINT,
dispatch,
customFetchOptions
).catch(() => sendErrorNotification(t('There was a problem when making release')))
).catch(() =>
sendErrorNotification(t('An error occurred while uploading the file'))
)
}
>
{t('Make Release')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ describe('components/Antd/DraftFileList', () => {
});
wrapper.update();

expect(mockNotificationError).toHaveBeenCalledWith('There was a problem when making release');
expect(mockNotificationError).toHaveBeenCalledWith(
'An error occurred while uploading the file'
);
});

it('renders correctly if manifest fetch is empty', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/form-config/src/components/DraftFiles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const ManifestDraftFiles = (props: ManifestDraftFilesProps): JSX.Element => {
manifestEndPoint,
undefined,
getPayload
).catch(() => displayAlertError('There was a problem when making release'))
).catch(() => displayAlertError('An error occurred while uploading the file'))
}
>
{makeReleaseLabel}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ describe('components/DraftFiles', () => {
await flushPromises();
});
wrapper.update();
expect(props.customAlert).toHaveBeenCalledWith('There was a problem when making release', {
expect(props.customAlert).toHaveBeenCalledWith('An error occurred while uploading the file', {
type: 'error',
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/form-config/src/components/UploadFile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ const UploadConfigFile = (props: UploadConfigFileProps & UploadDefaultProps) =>
endpoint
).catch(() => {
if (isEditMode) {
displayAlertError(t('There was a problem updating file'));
displayAlertError(t('There was a problem updating the file'));
} else {
displayAlertError(t('There was a problem when creating file'));
displayAlertError(t('There was a problem while creating the file'));
}
});
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ describe('components/UploadFile', () => {
await flushPromises();
});
expect(fetch).not.toHaveBeenCalled();
expect(props.customAlert).toHaveBeenCalledWith('There was a problem when creating file', {
expect(props.customAlert).toHaveBeenCalledWith('There was a problem while creating the file', {
type: 'error',
});
wrapper.unmount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ const InventoryItemForm: React.FC<InventoryItemFormProps> = (props: InventoryIte

submitForm(payload, openSRPBaseURL, setSubmitting, setIfDoneHere, t, inventoryID).catch(
(_: Error) => {
sendErrorNotification(t('There was a problem when submitting this form'));
sendErrorNotification(t('There was a problem while submitting this form'));
}
);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ describe('components/InventoryItemForm', () => {

expect(fetch.mock.calls).toHaveLength(0);
expect(notificationErrorMock).toHaveBeenCalledWith(
'There was a problem when submitting this form'
'There was a problem while submitting this form'
);
wrapper.unmount();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const InventoryAddEdit: React.FC<InventoryAddEditProps> = (props: InventoryAddEd
setProducts(response);
})
.catch((_: HTTPError) => {
sendErrorNotification(t('There was a problem fetching Product Catalogue'));
sendErrorNotification(t('There was a problem fetching the Product Catalogue'));
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const CreateEditUserGroup: React.FC<CreateEditGroupPropTypes> = (
assignedRolesPromise,
effectiveRolesPromise,
])
.catch(() => sendErrorNotification(t('There was a problem fetching group')))
.catch(() => sendErrorNotification(t('There was a problem fetching user groups')))
.finally(() => setIsLoading(false));
}
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ describe('forms/utils/submitForm', () => {
await flushPromises();
});

expect(notificationErrorMock).toHaveBeenCalledWith('There was a problem creating user');
expect(notificationErrorMock).toHaveBeenCalledWith('There was a problem creating the user');
expect(historyPushMock).not.toHaveBeenCalled();
});

Expand All @@ -384,7 +384,9 @@ describe('forms/utils/submitForm', () => {
await flushPromises();
});

expect(notificationErrorMock).toHaveBeenCalledWith('There was a problem updating user');
expect(notificationErrorMock).toHaveBeenCalledWith(
'There was a problem updating the user profile'
);
});

it('marks user as practitioner successfully', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ export const submitForm = async (
t
).catch(() => {
if (isEditMode) {
sendErrorNotification(t('There was a problem updating user'));
sendErrorNotification(t('There was a problem updating the user profile'));
} else {
sendErrorNotification(t('There was a problem creating user'));
sendErrorNotification(t('There was a problem creating the user'));
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ const NewLocationUnit = (props: NewLocationUnitProps) => {
queryClient
.invalidateQueries([LOCATION_HIERARCHY, grandparenthierarchy])
.catch(() =>
sendErrorNotification(t('There was a problem fetching the location hierachy'))
sendErrorNotification(t('An error occurred while refreshing the location data.'))
);
else sendErrorNotification(t('There was a problem getting hierachy node'));
else sendErrorNotification(t('There was a problem finding the location'));
}
dispatch(fetchAllHierarchies([]));
},
Expand Down

0 comments on commit cc359ac

Please sign in to comment.