Merge branch 'master' into 1197-admin-interface-created-transactions-list

This commit is contained in:
Hannes Heine 2021-12-21 15:52:57 +01:00 committed by GitHub
commit 3c80775d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 4 deletions

View File

@ -251,6 +251,44 @@ describe('Login', () => {
it('toasts an error message', () => { it('toasts an error message', () => {
expect(toastErrorMock).toBeCalledWith('error.no-account') 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 /thx/login', () => {
expect(mockRouterPush).toBeCalledWith('/thx/login')
})
})
describe('login fails with "User has no password set yet"', () => {
beforeEach(async () => {
apolloQueryMock.mockRejectedValue({
message: 'User has no password set yet',
})
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')
})
})
}) })
}) })
}) })

View File

@ -105,10 +105,10 @@ export default {
loader.hide() loader.hide()
}) })
.catch((error) => { .catch((error) => {
if (error.message.includes('No user with this credentials')) { this.$toasted.global.error(this.$t('error.no-account'))
this.$toasted.global.error(this.$t('error.no-account')) if (error.message.includes('User email not validated')) {
} else { this.$router.push('/thx/login')
// : this.$t('error.no-email-verify') } else if (error.message.includes('User has no password set yet')) {
this.$router.push('/reset/login') this.$router.push('/reset/login')
} }
loader.hide() loader.hide()