diff options
author | Sriram Viswanathan <sriramv@thoughtworks.com> | 2017-04-04 17:57:48 -0300 |
---|---|---|
committer | Sriram Viswanathan <sriramv@thoughtworks.com> | 2017-04-04 17:57:48 -0300 |
commit | 50d64627a924234ef5858b82bee8c9c33fb08f09 (patch) | |
tree | f2af020cd63976db53c8d2325b2b9ba4beb6063e /web-ui/src/account_recovery/new_password_form/new_password_form.spec.js | |
parent | 92523b7c8ceb8f3b7adf282e1b9e573ce5b37f04 (diff) |
[#938] Adds backup account step to forgot password flow
with @anikarni
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(); + }); }); }); |