diff options
author | Tulio Casagrande <tuliocasagrande@gmail.com> | 2017-04-05 11:34:48 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-05 11:34:48 -0300 |
commit | 658bc283585de7692af9b4d877962b2d0f96ebe0 (patch) | |
tree | 676b981ee3e4e4643f98816731c4e0f6fd5b9293 /web-ui/src/account_recovery/new_password_form/new_password_form.spec.js | |
parent | 770165d37909488519a76222a949d2353a3745f5 (diff) | |
parent | 8198fa48d2e42d89457940590ec4b308ee541090 (diff) |
Merge pull request #1044 from pixelated/backup_account_during_recovery
Backup account at end of account recovery
Diffstat (limited to 'web-ui/src/account_recovery/new_password_form/new_password_form.spec.js')
-rw-r--r-- | web-ui/src/account_recovery/new_password_form/new_password_form.spec.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/web-ui/src/account_recovery/new_password_form/new_password_form.spec.js b/web-ui/src/account_recovery/new_password_form/new_password_form.spec.js index 26b8651c..b57dd42e 100644 --- a/web-ui/src/account_recovery/new_password_form/new_password_form.spec.js +++ b/web-ui/src/account_recovery/new_password_form/new_password_form.spec.js @@ -7,9 +7,11 @@ import { NewPasswordForm } from './new_password_form'; describe('NewPasswordForm', () => { let newPasswordForm; let mockPrevious; + let mockNext; + let mockTranslations; beforeEach(() => { - const mockTranslations = key => key; + mockTranslations = key => key; mockPrevious = expect.createSpy(); newPasswordForm = shallow( <NewPasswordForm t={mockTranslations} previous={mockPrevious} userCode='def234' /> @@ -40,7 +42,11 @@ describe('NewPasswordForm', () => { }); describe('Submit', () => { - beforeEach(() => { + beforeEach((done) => { + mockNext = expect.createSpy().andCall(() => done()); + newPasswordForm = shallow( + <NewPasswordForm t={mockTranslations} previous={mockPrevious} userCode='def234' next={mockNext} /> + ); fetchMock.post('/account-recovery', 200); newPasswordForm.find('InputField[name="new-password"]').simulate('change', { target: { value: '123' } }); newPasswordForm.find('InputField[name="confirm-password"]').simulate('change', { target: { value: '456' } }); @@ -62,5 +68,9 @@ describe('NewPasswordForm', () => { it('sends password confirmation as content', () => { expect(fetchMock.lastOptions('/account-recovery').body).toContain('"confirmation":"456"'); }); + + it('calls next handler on success', () => { + expect(mockNext).toHaveBeenCalled(); + }); }); }); |