diff --git a/webapp/components/PasswordReset/VerifyCode.spec.js b/webapp/components/PasswordReset/VerifyCode.spec.js index 0d198721b..217c58ce9 100644 --- a/webapp/components/PasswordReset/VerifyCode.spec.js +++ b/webapp/components/PasswordReset/VerifyCode.spec.js @@ -26,6 +26,8 @@ describe('VerifyCode ', () => { }) describe('mount', () => { + beforeEach(jest.useFakeTimers) + Wrapper = () => { return mount(VerifyCode, { mocks, @@ -62,15 +64,25 @@ describe('VerifyCode ', () => { }) it('delivers new password to backend', () => { - const expected = expect.objectContaining({ variables: { newPassword: 'supersecret' } }) + const expected = expect.objectContaining({ + variables: { token: '123456', email: 'mail@example.org', newPassword: 'supersecret' }, + }) expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) }) describe('password reset successful', () => { it('displays success message', () => { - const expected = 'verify-code.change-password.sucess' + const expected = 'verify-code.form.change-password.success' expect(mocks.$t).toHaveBeenCalledWith(expected) }) + + describe('after animation', () => { + beforeEach(jest.runAllTimers) + + it('emits `change-password-sucess`', () => { + expect(wrapper.emitted('change-password-result')).toEqual([['success']]) + }) + }) }) }) }) diff --git a/webapp/components/PasswordReset/VerifyCode.vue b/webapp/components/PasswordReset/VerifyCode.vue index 67a164ba6..49f951324 100644 --- a/webapp/components/PasswordReset/VerifyCode.vue +++ b/webapp/components/PasswordReset/VerifyCode.vue @@ -32,42 +32,49 @@ {{ $t('verify-code.form.submit') }} - - - - - - - {{ $t('settings.security.change-password.button') }} - - - +