-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: improving tests and covering 100%
- Loading branch information
1 parent
0698ade
commit a545a38
Showing
13 changed files
with
180 additions
and
8 deletions.
There are no files selected for viewing
Binary file not shown.
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
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
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
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 |
---|---|---|
|
@@ -108,4 +108,28 @@ describe("getOnlyEmail", () => { | |
); | ||
expect(result).toBe("[email protected]"); | ||
}); | ||
|
||
it("should return the first email when repeatEmail is true and multiple is false", () => { | ||
const result = getOnlyEmail( | ||
"Entre em contato com a equipe: [email protected], [email protected]", | ||
{ multiple: false, cleanDomain: false, repeatEmail: true } | ||
); | ||
expect(result).toBe("[email protected]"); | ||
}); | ||
|
||
it("should return the first cleaned email when repeatEmail is true and multiple is false", () => { | ||
const result = getOnlyEmail( | ||
"Entre em contato com a equipe: [email protected], [email protected]", | ||
{ multiple: false, cleanDomain: true, repeatEmail: true } | ||
); | ||
expect(result).toBe("[email protected]"); | ||
}); | ||
|
||
it("should return all cleaned emails when repeatEmail is true and multiple is true", () => { | ||
const result = getOnlyEmail( | ||
"Entre em contato com a equipe: [email protected], [email protected]", | ||
{ multiple: true, cleanDomain: true, repeatEmail: true } | ||
); | ||
expect(result).toEqual(["[email protected]", "[email protected]"]); | ||
}); | ||
}); |
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
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
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 |
---|---|---|
|
@@ -116,4 +116,13 @@ describe("validateEmail", () => { | |
expect(result.isValid).toBe(true); | ||
expect(result.errorMsg).toBe(null); | ||
}); | ||
|
||
it("should validate email and return the custom error message and defaultMsgErrors too", () => { | ||
const result = validateEmail("[email protected]", { | ||
errorMsg: ["Custom error message", null, "Custom error message 2"], | ||
}); | ||
|
||
expect(result.isValid).toBe(false); | ||
expect(result.errorMsg).toBe("This e-mail is not valid"); | ||
}); | ||
}); |
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
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
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
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
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