-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZENKO-3313 fix account creation page discrepencies
- Loading branch information
theo-cerutti
committed
Apr 7, 2021
1 parent
96474de
commit 4d53e33
Showing
6 changed files
with
207 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,109 +33,85 @@ describe('AccountCreate', () => { | |
description: 'should render no error if both name and email are valid', | ||
name: 'ba', | ||
email: '[email protected]', | ||
quota: '', | ||
expectedNameError: '', | ||
expectedEmailError: '', | ||
expectedQuotaError: '', | ||
}, | ||
{ | ||
description: 'should render no error if name, email and quota are valid', | ||
name: 'ba', | ||
email: '[email protected]', | ||
quota: '1', | ||
expectedNameError: '', | ||
expectedEmailError: '', | ||
expectedQuotaError: '', | ||
}, | ||
{ | ||
description: 'should render error if name is missing', | ||
name: '', | ||
email: '[email protected]', | ||
quota: '1', | ||
expectedNameError: '"Name" is not allowed to be empty', | ||
expectedEmailError: '', | ||
expectedQuotaError: '', | ||
}, | ||
{ | ||
description: 'should render error if email is missing', | ||
name: 'bart', | ||
email: '', | ||
quota: '1', | ||
expectedNameError: '', | ||
expectedEmailError: '"Root Account Email" is not allowed to be empty', | ||
expectedQuotaError: '', | ||
}, | ||
{ | ||
description: 'should render 2 errors if name and email are missing', | ||
name: '', | ||
email: '', | ||
quota: '1', | ||
expectedNameError: '"Name" is not allowed to be empty', | ||
expectedEmailError: '"Root Account Email" is not allowed to be empty', | ||
expectedQuotaError: '', | ||
}, | ||
{ | ||
description: 'should render error if name is too short', | ||
name: 'b', | ||
email: '[email protected]', | ||
quota: '1', | ||
expectedNameError: '"Name" length must be at least 2 characters long', | ||
expectedEmailError: '', | ||
expectedQuotaError: '', | ||
}, | ||
{ | ||
description: 'should render error if name is too long (> 64)', | ||
name: 'b'.repeat(65), | ||
email: '[email protected]', | ||
quota: '1', | ||
expectedNameError: '"Name" length must be less than or equal to 64 characters long', | ||
expectedEmailError: '', | ||
expectedQuotaError: '', | ||
}, | ||
{ | ||
description: 'should render error if name is invalid', | ||
name: '^^', | ||
email: '[email protected]', | ||
quota: '1', | ||
expectedNameError: 'Invalid Name', | ||
expectedEmailError: '', | ||
expectedQuotaError: '', | ||
}, | ||
{ | ||
description: 'should render error if email is invalid', | ||
name: 'bart', | ||
email: 'invalid', | ||
quota: '1', | ||
expectedNameError: '', | ||
expectedEmailError: 'Invalid Root Account Email', | ||
expectedQuotaError: '', | ||
}, | ||
{ | ||
description: 'should render error if email is too long (> 256)', | ||
name: 'bart', | ||
email: `${'b'.repeat(257)}@long.com`, | ||
quota: '1', | ||
expectedNameError: '', | ||
expectedEmailError: '"Root Account Email" length must be less than or equal to 256 characters long', | ||
expectedQuotaError: '', | ||
}, | ||
{ | ||
description: 'should render error if quota is invalid', | ||
name: 'bart', | ||
email: '[email protected]', | ||
quota: '-1', | ||
expectedNameError: '', | ||
expectedEmailError: '', | ||
expectedQuotaError: '"Quota" must be a positive number', | ||
}, | ||
{ | ||
description: 'should render error if quota is set to 0', | ||
name: 'bart', | ||
email: '[email protected]', | ||
quota: '0', | ||
expectedNameError: '', | ||
expectedEmailError: '', | ||
expectedQuotaError: '"Quota" must be a positive number', | ||
}, | ||
]; | ||
|
||
|
@@ -153,10 +129,6 @@ describe('AccountCreate', () => { | |
elementEmail.getDOMNode().value = t.email; | ||
elementEmail.getDOMNode().dispatchEvent(new Event('input')); | ||
|
||
const elementQuota = component.find('input#quota'); | ||
elementQuota.getDOMNode().value = t.quota; | ||
elementQuota.getDOMNode().dispatchEvent(new Event('input')); | ||
|
||
await act(async () => { | ||
component.find('Button#create-account-btn').simulate('click'); | ||
}); | ||
|
@@ -173,12 +145,6 @@ describe('AccountCreate', () => { | |
} else { | ||
expect(component.find('ErrorInput#error-email').text()).toBeFalsy(); | ||
} | ||
if (t.expectedQuotaError) { | ||
expect(component.find('ErrorInput#error-quota').text()).toContain(t.expectedQuotaError); | ||
} else { | ||
expect(component.find('ErrorInput#error-quota').text()).toBeFalsy(); | ||
} | ||
|
||
component.unmount(); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.