9
test/utils/newSanitizer.utils.test.ts
Normal file
9
test/utils/newSanitizer.utils.test.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { removeNewlineAndPTag } from "../../src/utils/newSanitizer";
|
||||
|
||||
describe('newSanitizer', () => {
|
||||
test('Should remove /\n and <p>/</p> elements', () => {
|
||||
const input = "\n<p>This is a string</p>";
|
||||
const expectedOutput = "This is a string"
|
||||
expect(removeNewlineAndPTag(input)).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
@@ -1,9 +1,18 @@
|
||||
import { removeNewlineAndPTag } from "../../src/utils/sanitizer.utils";
|
||||
import { getDomainFromEmail } from "../../src/utils/sanitizer.utils";
|
||||
|
||||
describe('sanitizer', () => {
|
||||
test('Should remove /\n and <p>/</p> elements', () => {
|
||||
const input = "\n<p>This is a string</p>";
|
||||
const expectedOutput = "This is a string"
|
||||
expect(removeNewlineAndPTag(input)).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
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);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ export const inputs: any[] = [
|
||||
{
|
||||
rid: "202308017159276",
|
||||
uid: "G59276",
|
||||
trainuid: "1M83",
|
||||
trainid: "1M83",
|
||||
sdd: "2023-08-01",
|
||||
operator: "CrossCountry",
|
||||
operatorCode: "XC",
|
||||
|
||||
@@ -35,6 +35,8 @@ export const outputs: any[] = [
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
busServices: [],
|
||||
ferryServices: []
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user