mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
image upload: fixed tests
This commit is contained in:
parent
650e83f4c2
commit
001515f92a
@ -151,6 +151,7 @@ describe('ContributionForm.vue', () => {
|
|||||||
aspectRatio: null,
|
aspectRatio: null,
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
upload: imageUpload,
|
upload: imageUpload,
|
||||||
|
type: null,
|
||||||
}
|
}
|
||||||
const spy = jest
|
const spy = jest
|
||||||
.spyOn(FileReader.prototype, 'readAsDataURL')
|
.spyOn(FileReader.prototype, 'readAsDataURL')
|
||||||
|
|||||||
@ -25,19 +25,11 @@ describe('ImageUploader.vue', () => {
|
|||||||
|
|
||||||
describe('handles errors', () => {
|
describe('handles errors', () => {
|
||||||
beforeEach(() => jest.useFakeTimers())
|
beforeEach(() => jest.useFakeTimers())
|
||||||
const message = 'File upload failed'
|
const unSupportedFileMessage = 'message'
|
||||||
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)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('shows an error toaster when unSupported file is uploaded', () => {
|
it('shows an error toaster when unSupported file is uploaded', () => {
|
||||||
wrapper.vm.onUnSupportedFormat(fileError.status, unSupportedFileMessage)
|
wrapper.vm.onUnSupportedFormat(unSupportedFileMessage)
|
||||||
expect(mocks.$toast.error).toHaveBeenCalledWith(fileError.status, unSupportedFileMessage)
|
expect(mocks.$toast.error).toHaveBeenCalledWith(unSupportedFileMessage)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user