backend/test/utils/sanitizer.utils.test.ts
Fred Boniface 2d2fdbb8db Corrections to unit tests
Signed-off-by: Fred Boniface <fred@fjla.uk>
2023-08-01 22:45:08 +01:00

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);
})
}
});