diff --git a/src/common/editFileDialog.component.test.tsx b/src/common/editFileDialog.component.test.tsx index abe94d589..b119dd77f 100644 --- a/src/common/editFileDialog.component.test.tsx +++ b/src/common/editFileDialog.component.test.tsx @@ -98,7 +98,7 @@ describe('Edit file dialog', () => { await user.click(saveButton); expect(axiosPatchSpy).toHaveBeenCalledWith('/images/1', { - file_name: 'test_file_name.jpeg', + file_name: 'test_file_name.jpeg.png', title: 'Test Title', description: 'Test Description', }); diff --git a/src/common/editFileDialog.component.tsx b/src/common/editFileDialog.component.tsx index 965853863..4b0e58026 100644 --- a/src/common/editFileDialog.component.tsx +++ b/src/common/editFileDialog.component.tsx @@ -53,7 +53,7 @@ const EditFileDialog = (props: FileDialogProps) => { const selectedFileCopy: ObjectFilePatch = React.useMemo( () => (selectedFile ? { ...selectedFile, file_name: initialName } : {}), - [selectedFile] + [selectedFile, initialName] ); const initialFile: ObjectFilePatch = React.useMemo( @@ -109,7 +109,7 @@ const EditFileDialog = (props: FileDialogProps) => { const isTitleUpdated = fileData.title !== selectedFileCopy.title; - let fileToEdit: ObjectFilePatch = {}; + const fileToEdit: ObjectFilePatch = {}; if (isFileNameUpdated) fileToEdit.file_name = fileData.file_name + extension; diff --git a/src/mocks/handlers.ts b/src/mocks/handlers.ts index eafacac1c..744da8284 100644 --- a/src/mocks/handlers.ts +++ b/src/mocks/handlers.ts @@ -1084,7 +1084,7 @@ export const handlers = [ const fullBody = { ...obj, ...body }; - if (fullBody.file_name === 'Error 500') { + if (fullBody.file_name === 'Error 500.png') { return HttpResponse.json( { detail: 'Something went wrong' }, { status: 500 }