diff options
author | Tayane Fernandes <tayane.rmf@gmail.com> | 2017-03-10 15:35:24 -0300 |
---|---|---|
committer | Tayane Fernandes <tayane.rmf@gmail.com> | 2017-03-10 15:35:24 -0300 |
commit | 8b42d7b769807031e808e5212cd5c50097db333b (patch) | |
tree | 9a442b94c1f97fd37947043a25279213f0198d0d /web-ui/test | |
parent | 9e5dce775c51b44cf7b17d8ab564fdefc16a06c0 (diff) |
[#923] Create integration test for the validation of backup account
with @FrailWords
Diffstat (limited to 'web-ui/test')
-rw-r--r-- | web-ui/test/integration/backup_account.spec.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/web-ui/test/integration/backup_account.spec.js b/web-ui/test/integration/backup_account.spec.js new file mode 100644 index 00000000..2a37442e --- /dev/null +++ b/web-ui/test/integration/backup_account.spec.js @@ -0,0 +1,35 @@ +import { mount } from 'enzyme'; +import expect from 'expect'; +import React from 'react'; +import App from 'src/common/app'; +import BackupAccountPage from 'src/backup_account/page'; +import testI18n from './i18n'; + +describe('Backup account email validation', () => { + context('Backup Account Page', () => { + let app, backupAccountPage; + + beforeEach(() => { + app = mount(<App i18n={testI18n} child={<BackupAccountPage />} />); + backupAccountPage = app.find('Page'); + }); + + it('shows no error and enables submit button when a valid email is entered', () => { + backupAccountPage.find('input').simulate('change', {target: {value: 'test@test.com'}}); + expect(backupAccountPage.find('InputField').props().errorText).toEqual(''); + expect(backupAccountPage.find('SubmitButton').props().disabled).toEqual(false); + }); + + it('shows error and disables submit button on invalid email', () => { + backupAccountPage.find('input').simulate('change', {target: {value: 'test'}}); + expect(backupAccountPage.find('InputField').props().errorText).toEqual('Your email is invalid'); + expect(backupAccountPage.find('SubmitButton').props().disabled).toEqual(true); + }); + + it('shows no error and disables submit button when email is empty', () => { + backupAccountPage.find('input').simulate('change', {target: {value: ''}}); + expect(backupAccountPage.find('InputField').props().errorText).toEqual(''); + expect(backupAccountPage.find('SubmitButton').props().disabled).toEqual(true); + }); + }); +}); |