19 lines
585 B
TypeScript
19 lines
585 B
TypeScript
import { getDomainFromEmail } from "../../src/utils/sanitizer.utils";
|
|
|
|
describe('Sanitize Email', () => {
|
|
const inputs = [
|
|
"this+is+an-_email@example.com",
|
|
'"unusual email"@example.com',
|
|
"(brackets)addr@example.com",
|
|
"I%Have{Special}%Characters@example.com",
|
|
"Basic.address@example.com",
|
|
`"very.(),:;<>[]\".VERY.\"very\ \"very\".unusual"@example.com`
|
|
]
|
|
const expectedOutput = "example.com"
|
|
for (const addr of inputs) {
|
|
test(`Should return only domain: ${addr}`, () => {
|
|
expect(getDomainFromEmail(addr)).toEqual(expectedOutput);
|
|
})
|
|
}
|
|
});
|