summaryrefslogtreecommitdiff
path: root/web-ui/test
diff options
context:
space:
mode:
authorSriram Viswanathan <sriramv@thoughtworks.com>2017-03-10 17:36:24 -0300
committerSriram Viswanathan <sriramv@thoughtworks.com>2017-03-10 17:36:24 -0300
commitdef51d0d4265e9a489d05ca8cb4bec6abb26073f (patch)
tree9a6567736a3e64ea56dda83d39da4031bb107d16 /web-ui/test
parent908806ee4d2e94c691f8fb7f4ada6d45e7e9a282 (diff)
[#923] Separate out asserts into different tests
with @tayanefernandes
Diffstat (limited to 'web-ui/test')
-rw-r--r--web-ui/test/integration/backup_account.spec.js48
1 files changed, 36 insertions, 12 deletions
diff --git a/web-ui/test/integration/backup_account.spec.js b/web-ui/test/integration/backup_account.spec.js
index eb247653..b44c3b2c 100644
--- a/web-ui/test/integration/backup_account.spec.js
+++ b/web-ui/test/integration/backup_account.spec.js
@@ -14,22 +14,46 @@ describe('Backup account email validation', () => {
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);
+ context('with valid email', () => {
+ beforeEach(() => {
+ backupAccountPage.find('input').simulate('change', {target: {value: 'test@test.com'}});
+ });
+
+ it('shows no validation error', () => {
+ expect(backupAccountPage.find('InputField').props().errorText).toEqual('');
+ });
+
+ it('submit button is enabled', () => {
+ 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('Please enter a valid email address');
- expect(backupAccountPage.find('SubmitButton').props().disabled).toEqual(true);
+ context('with invalid email', () => {
+ beforeEach(() => {
+ backupAccountPage.find('input').simulate('change', {target: {value: 'test'}});
+ });
+
+ it('shows validation error', () => {
+ expect(backupAccountPage.find('InputField').props().errorText).toEqual('Please enter a valid email address');
+ });
+
+ it('disables submit button', () => {
+ 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);
+ context('with empty email', () => {
+ beforeEach(() => {
+ backupAccountPage.find('input').simulate('change', {target: {value: ''}});
+ });
+
+ it('shows no validation error', () => {
+ expect(backupAccountPage.find('InputField').props().errorText).toEqual('');
+ });
+
+ it('disables submit button', () => {
+ expect(backupAccountPage.find('SubmitButton').props().disabled).toEqual(true);
+ });
});
});
});