-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mail: EAI: Change email address regexp to allow Unicode letters, but …
…not special
- Loading branch information
1 parent
fe3cd84
commit 74dce04
Showing
2 changed files
with
69 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { sanitize } from '../../../lib/util/sanitizeDatatypes'; | ||
import { expect, test } from 'vitest'; | ||
|
||
test("Check Latin email addresses", () => { | ||
sanitize.emailAddress("dh@example.com"); | ||
sanitize.emailAddress("dh@example.im"); | ||
sanitize.emailAddress("dh@example.mobile"); | ||
sanitize.emailAddress("dh@example.im"); | ||
sanitize.emailAddress("dh@ex-ample.im"); | ||
sanitize.emailAddress("dh+g@example.im"); | ||
sanitize.emailAddress("dh.g@example.im"); | ||
sanitize.emailAddress("dh-g@example.im"); | ||
expect(() => { | ||
sanitize.emailAddress("d@com"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d@example.c-om"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d@example.-com"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d@example.com-"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d#h@example.com"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d h@example.com"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d%20h@example.com"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d\\h@example.com"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d\nh@example.com"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d\rh@example.com"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d\th@example.com"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d`h@example.com"); | ||
}).toThrow(); | ||
}); | ||
|
||
test("Check EAI email addresses", () => { | ||
sanitize.emailAddress("ндрис@уайлддк.орг"); | ||
sanitize.emailAddress("ндрис@уайлддк.xn--4dn5"); | ||
sanitize.emailAddress("нд1²³рис@уай1²³лддк.орг"); | ||
sanitize.emailAddress("äüößéáúàèù@äüößéáúàèù.com"); | ||
expect(() => { | ||
sanitize.emailAddress("d@d.xn-4dn5"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d@d.xn--"); | ||
}).toThrow(); | ||
expect(() => { | ||
sanitize.emailAddress("d@d.xn-"); | ||
}).toThrow(); | ||
}); |
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