diff --git a/webapp/components/PasswordReset/VerifyCode.spec.js b/webapp/components/PasswordReset/VerifyCode.spec.js index 3904f62f2..63e8ce2b3 100644 --- a/webapp/components/PasswordReset/VerifyCode.spec.js +++ b/webapp/components/PasswordReset/VerifyCode.spec.js @@ -20,7 +20,7 @@ describe('VerifyCode ', () => { $t: jest.fn(), $apollo: { loading: false, - mutate: jest.fn().mockResolvedValue({ data: { resetPassword: false } }), + mutate: jest.fn().mockResolvedValue({ data: { resetPassword: true } }), }, } }) @@ -50,9 +50,27 @@ describe('VerifyCode ', () => { }) describe('submitting new password', () => { - it.todo('calls resetPassword graphql mutation') - it.todo('delivers new password to backend') - it.todo('displays success message') + beforeEach(() => { + wrapper.find('input#newPassword').setValue('supersecret') + wrapper.find('input#confirmPassword').setValue('supersecret') + wrapper.find('form').trigger('submit') + }) + + it('calls resetPassword graphql mutation', () => { + expect(mocks.$apollo.mutate).toHaveBeenCalled() + }) + + it('delivers new password to backend', () => { + const expected = expect.objectContaining({ variables: { newPassword: 'supersecret' } }) + expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) + }) + + describe('password reset successful', () => { + it('displays success message', () => { + const expected = 'verify-code.change-password.sucess' + expect(mocks.$t).toHaveBeenCalledWith(expected) + }) + }) }) }) }) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 2c5f9a07e..cd04befe0 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -26,7 +26,11 @@ "form": { "input": "Code eingeben", "description": "Öffne Deine E-Mail Postfach und gib den Code ein, den wir geschickt haben.", - "submit": "Sicherheitscode überprüfen" + "submit": "Sicherheitscode überprüfen", + "change-password":{ + "success": "Änderung des Passworts war erfolgreich", + "failure": "Passwort Änderung fehlgeschlagen. Möglicherweise falscher Sicherheitscode." + } } }, "editor": { diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 44d1153da..b0dcc0f03 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -26,7 +26,11 @@ "form": { "input": "Enter your code", "description": "Open your inbox and enter the code that we've sent to you.", - "submit": "Check security code" + "submit": "Check security code", + "change-password": { + "success": "Changing your password was successful", + "failure": "Changing your password failed. Probably the security code was not correct" + } } }, "editor": {