-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hotfix/check email value with dot (#13)
* replace function in helpers * adapt testing * adapt email regex to handle tiret and underscores * hotfix test result
- Loading branch information
Showing
3 changed files
with
104 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import Transaction from '../../models/Transaction'; | ||
import { | ||
canProcessSloCode, | ||
checkDomainValue, | ||
checkEmailValue, | ||
extractParamsFromUri, | ||
logOutBody, | ||
prepareConfig, | ||
|
@@ -316,3 +318,80 @@ describe('helpers#canProcessSloCode/2', () => { | |
).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
describe('helper#checkEmaiValue/1', () => { | ||
it('returns false if empty string value', () => { | ||
expect(() => checkEmailValue('')).toThrowError( | ||
'Please provide non blank string for email' | ||
); | ||
}); | ||
it('returns false if wrong string value', () => { | ||
expect(() => checkEmailValue('azerty')).toThrowError( | ||
'Please provide valid email' | ||
); | ||
}); | ||
|
||
it('returns false if @ string value', () => { | ||
expect(() => checkEmailValue('@')).toThrowError( | ||
'Please provide valid email' | ||
); | ||
}); | ||
|
||
it('returns true if simple string value', () => { | ||
expect(checkEmailValue('[email protected]')).toEqual('[email protected]'); | ||
}); | ||
|
||
it('returns true if dotted email string value', () => { | ||
expect(checkEmailValue('[email protected]')).toEqual( | ||
'[email protected]' | ||
); | ||
}); | ||
|
||
it('returns false if ending first part with dots email string value', () => { | ||
expect(() => checkEmailValue('[email protected]')).toThrowError( | ||
'Please provide valid email' | ||
); | ||
}); | ||
|
||
it('returns false if alias email string value', () => { | ||
expect(() => checkEmailValue('[email protected]')).toThrowError( | ||
'Please provide valid email' | ||
); | ||
}); | ||
|
||
it('returns truthy if tiret email string value', () => { | ||
expect(checkEmailValue('[email protected]')).toEqual( | ||
'[email protected]' | ||
); | ||
}); | ||
|
||
it('returns truthy if underscored email string value', () => { | ||
expect(checkEmailValue('[email protected]')).toEqual( | ||
'[email protected]' | ||
); | ||
}); | ||
}); | ||
|
||
describe('helpers#checkDomainValue/1', () => { | ||
it('should throw error if empy input', () => { | ||
expect(() => checkDomainValue(' ')).toThrowError( | ||
'Please provide non blank string for domain' | ||
); | ||
}); | ||
|
||
it('should throw error if underscored input', () => { | ||
expect(() => checkDomainValue('_')).toThrowError( | ||
'Please provide valid domain (alphanumeric dashed separated)' | ||
); | ||
}); | ||
|
||
it('should throw error if standard account complex name input', () => { | ||
expect(() => checkDomainValue("My awesome Company's name")).toThrowError( | ||
'Please provide valid domain (alphanumeric dashed separated)' | ||
); | ||
}); | ||
|
||
it('should return value if proper domain input', () => { | ||
expect(checkDomainValue('communitiz-app')).toEqual('communitiz-app'); | ||
}); | ||
}); |
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