toast an error when forgot password fails

This commit is contained in:
Moriz Wahl 2022-03-30 18:33:46 +02:00
parent ef3420ef2e
commit 749b9c38c3
2 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,8 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import ForgotPassword from './ForgotPassword'
import { toastErrorSpy } from '@test/testSetup'
const mockAPIcall = jest.fn()
const localVue = global.localVue
@ -116,6 +118,10 @@ describe('ForgotPassword', () => {
await flushPromises()
})
it('toasts a standard error message', () => {
expect(toastErrorSpy).toBeCalledWith('error.email-already-sent')
})
it('pushes to "/thx/forgotPassword"', () => {
expect(mockAPIcall).toBeCalledWith(
expect.objectContaining({

View File

@ -69,6 +69,7 @@ export default {
this.$router.push('/thx/forgotPassword')
})
.catch(() => {
this.toastError(this.$t('error.email-already-sent'))
this.$router.push('/thx/forgotPassword')
})
},