-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.js
30 lines (26 loc) · 1.07 KB
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const { getName, parseEmailForComparing } = require("./index");
describe("all tests", () => {
it("getName", () => {
const test_data = [
{ input: undefined, expected: "" },
{ input: { firstName: "", lastName: "" }, expected: "" },
{ input: { firstName: "Joe Ann", lastName: "" }, expected: "Joe" },
{ input: { firstName: "Joey J", lastName: "Ann" }, expected: "Joey J" },
];
for (let test_case of test_data) {
expect(getName(test_case.input)).toBe(test_case.expected);
}
});
it("parseEmails", () => {
const test_data = [
{ input: "[email protected]", expected: "[email protected]" },
{ input: "[email protected]", expected: "[email protected]" },
{ input: "[email protected]", expected: "[email protected]" },
{ input: "[email protected]", expected: "[email protected]" },
{ input: "[email protected]", expected: "[email protected]" },
];
for (let test_case of test_data) {
expect(parseEmailForComparing(test_case.input)).toBe(test_case.expected);
}
});
});