From 001515f92a43f969c8e30522bbd085911b714a0b Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 8 Feb 2021 16:50:50 +0100 Subject: [PATCH] image upload: fixed tests --- .../ContributionForm/ContributionForm.spec.js | 1 + .../components/ImageUploader/ImageUploader.spec.js | 14 +++----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index eb4e9cd5a..cce187a63 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -151,6 +151,7 @@ describe('ContributionForm.vue', () => { aspectRatio: null, sensitive: false, upload: imageUpload, + type: null, } const spy = jest .spyOn(FileReader.prototype, 'readAsDataURL') diff --git a/webapp/components/ImageUploader/ImageUploader.spec.js b/webapp/components/ImageUploader/ImageUploader.spec.js index 537febac3..200369436 100644 --- a/webapp/components/ImageUploader/ImageUploader.spec.js +++ b/webapp/components/ImageUploader/ImageUploader.spec.js @@ -25,19 +25,11 @@ describe('ImageUploader.vue', () => { describe('handles errors', () => { beforeEach(() => jest.useFakeTimers()) - const message = 'File upload failed' - const fileError = { status: 'error' } - const unSupportedFileMessage = - 'Please upload an image of file format : JPG , JPEG , PNG or GIF' - - it('shows an error toaster when verror is called', () => { - wrapper.vm.onDropzoneError(fileError, message) - expect(mocks.$toast.error).toHaveBeenCalledWith(fileError.status, message) - }) + const unSupportedFileMessage = 'message' it('shows an error toaster when unSupported file is uploaded', () => { - wrapper.vm.onUnSupportedFormat(fileError.status, unSupportedFileMessage) - expect(mocks.$toast.error).toHaveBeenCalledWith(fileError.status, unSupportedFileMessage) + wrapper.vm.onUnSupportedFormat(unSupportedFileMessage) + expect(mocks.$toast.error).toHaveBeenCalledWith(unSupportedFileMessage) }) }) })