Remove unused prop, add error boundary handling

This commit is contained in:
Matt Rider 2019-06-04 08:57:22 -03:00
parent db0ad1a315
commit 8e96179b33
2 changed files with 10 additions and 1 deletions

View File

@ -7,7 +7,6 @@
:use-custom-slot="true"
:options="dropzoneOptions"
@vdropzone-error="verror"
@vdropzone-thumbnail="thumbnail"
>
<div class="dz-message" @mouseover="hover = true" @mouseleave="hover = false">
<hc-avatar :user="user" class="profile-avatar" size="x-large"></hc-avatar>

View File

@ -68,5 +68,15 @@ describe('Upload', () => {
jest.runAllTimers()
expect(wrapper.vm.error).toEqual(false)
})
it('shows an error toaster when the apollo mutation rejects', async () => {
// calls vddrop twice because of how mockResolvedValueOnce works in jest
// the first time the mock function is called it will resolve, calling it a
// second time will cause it to fail(with this implementation)
// https://jestjs.io/docs/en/mock-function-api.html#mockfnmockresolvedvalueoncevalue
await wrapper.vm.vddrop([{ filename: 'avatar.jpg' }])
await wrapper.vm.vddrop([{ filename: 'avatar.jpg' }])
expect(mocks.$toast.error).toHaveBeenCalledTimes(1)
})
})
})