Apply suggestions from code review [skip ci]

Co-authored-by: Daniel Huigens <d.huigens@protonmail.com>
This commit is contained in:
larabr 2024-02-02 14:55:31 +01:00 committed by GitHub
parent 7d7a8dc113
commit 9729d4ff75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -459,8 +459,9 @@ const util = {
/**
* Test email format based on W3C HTML5 specification.
* This check is not exaustive, and includes a willful violation of RFC5322
* (see https://html.spec.whatwg.org/multipage/input.html#email-state-(type=email))
* This check is not exaustive, and does not match RFC 5322 exactly
* (see https://html.spec.whatwg.org/multipage/input.html#email-state-(type=email)),
* but is commonly used for email address validation.
*/
isEmailAddress: function(data) {
if (!util.isString(data)) {

View File

@ -108,7 +108,7 @@ export default () => describe('Util unit tests', function() {
const data = 'test@example.com';
expect(util.isEmailAddress(data)).to.be.true;
});
it('should return true for valid email address (-- in domain part)', function() {
it('should return true for valid email address (internationalized domain name)', function() {
const data = 'test@xn--wgv.xn--q9jyb4c';
expect(util.isEmailAddress(data)).to.be.true;
});
@ -116,8 +116,8 @@ export default () => describe('Util unit tests', function() {
const data = 'test1@com.com09';
expect(util.isEmailAddress(data)).to.be.true;
});
it('should return false for invalid email address (no . in domain part)', function() {
const data = 'test@examplecom';
it('should return true for valid email address (no . in domain part)', function() {
const data = 'test@localhost';
expect(util.isEmailAddress(data)).to.be.true;
});
it('should return false for invalid email address (full userID)', function() {