diff --git a/src/taxonomy/data/apiHooks.test.jsx b/src/taxonomy/data/apiHooks.test.jsx index d865aa4f13..e0160ad8d7 100644 --- a/src/taxonomy/data/apiHooks.test.jsx +++ b/src/taxonomy/data/apiHooks.test.jsx @@ -17,6 +17,10 @@ jest.mock('./api', () => ({ deleteTaxonomy: jest.fn(), })); +/* + * TODO: We can refactor this test: Mock the API response using axiosMock. + * Ref: https://github.com/openedx/frontend-app-course-authoring/pull/684#issuecomment-1847694090 + */ describe('useTaxonomyListDataResponse', () => { it('should return data when status is success', () => { useQuery.mockReturnValueOnce({ status: 'success', data: { data: 'data' } }); diff --git a/src/taxonomy/delete-dialog/index.jsx b/src/taxonomy/delete-dialog/index.jsx index 229d29ff7e..93854f1972 100644 --- a/src/taxonomy/delete-dialog/index.jsx +++ b/src/taxonomy/delete-dialog/index.jsx @@ -22,18 +22,18 @@ const DeleteDialog = ({ const [deleteButtonDisabled, setDeleteButtonDisabled] = useState(true); const deleteLabel = intl.formatMessage(messages.deleteDialogConfirmDeleteLabel); - const handleInputChange = (event) => { + const handleInputChange = React.useCallback((event) => { if (event.target.value === deleteLabel) { setDeleteButtonDisabled(false); } else { setDeleteButtonDisabled(true); } - }; + }); - const onClickDelete = () => { + const onClickDelete = React.useCallback(() => { onClose(); onDelete(); - }; + }, [onClose, onDelete]); return ( { + const onClickExport = React.useCallback(() => { onClose(); getTaxonomyExportFile(taxonomyId, outputFormat); - }; + }, [onClose, taxonomyId, outputFormat]); return (