-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #845 from CodingNagger/master
Adding support for IP address email validation #800
- Loading branch information
Showing
5 changed files
with
167 additions
and
72 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
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 |
---|---|---|
|
@@ -98,6 +98,8 @@ describe('Validators', () => { | |
'[email protected]', | ||
'[email protected]', | ||
'test123+invalid! [email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
], | ||
}); | ||
}); | ||
|
@@ -228,6 +230,52 @@ describe('Validators', () => { | |
}); | ||
}); | ||
|
||
it('should validate email addresses with allowed IPs', () => { | ||
test({ | ||
validator: 'isEmail', | ||
args: [{ allow_ip_domain: true }], | ||
valid: [ | ||
'email@[123.123.123.123]', | ||
'[email protected]', | ||
], | ||
invalid: [ | ||
'invalidemail@', | ||
'invalid.com', | ||
'@invalid.com', | ||
'[email protected].', | ||
'somename@gmail.com', | ||
'[email protected].', | ||
'[email protected]', | ||
'gmailgmailgmailgmailgmail@gmail.com', | ||
`${repeat('a', 64)}@${repeat('a', 251)}.com`, | ||
`${repeat('a', 65)}@${repeat('a', 250)}.com`, | ||
`${repeat('a', 64)}@${repeat('a', 64)}.com`, | ||
`${repeat('a', 31)}@gmail.com`, | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected] m', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'test123+invalid! [email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
], | ||
}); | ||
}); | ||
|
||
it('should validate URLs', () => { | ||
test({ | ||
|
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
Large diffs are not rendered by default.
Oops, something went wrong.