coverage PasswordReset/Request.spec.js

This commit is contained in:
Ulf Gebhardt 2021-04-24 02:09:10 +02:00
parent fc176e28a4
commit 0e6893eeb3
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD

View File

@ -95,5 +95,20 @@ describe('Request', () => {
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected)
})
})
describe('backend throws an error', () => {
beforeEach(() => {
mocks.$apollo.mutate = jest.fn().mockRejectedValue({
message: 'Ouch!',
})
wrapper = Wrapper()
wrapper.find('input#email').setValue('mail@gmail.com')
wrapper.find('form').trigger('submit')
})
it('display a toast error', () => {
expect(mocks.$toast.error).toHaveBeenCalled()
})
})
})
})