Test redirect when no password is present

This commit is contained in:
Moriz Wahl 2021-12-13 10:38:05 +01:00
parent 052a031aaa
commit 7b8426593e

View File

@ -251,6 +251,25 @@ describe('Login', () => {
it('toasts an error message', () => {
expect(toastErrorMock).toBeCalledWith('error.no-account')
})
describe('login fails with "User email not validated"', () => {
beforeEach(async () => {
apolloQueryMock.mockRejectedValue({
message: 'User email not validated',
})
wrapper = Wrapper()
jest.clearAllMocks()
await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
await wrapper.find('input[placeholder="form.password"]').setValue('1234')
await flushPromises()
await wrapper.find('form').trigger('submit')
await flushPromises()
})
it('redirects to /reset/login', () => {
expect(mockRouterPush).toBeCalledWith('/reset/login')
})
})
})
})
})