-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/LBAC-1680-webhook-brevo-avec-clef
- Loading branch information
Showing
22 changed files
with
156 additions
and
59 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import assert from "assert" | ||
|
||
import { cleanEmail } from "shared/helpers/common" | ||
import { cleanEmail, removeUrlsFromText, disableUrlsWith0WidthChar } from "shared/helpers/common" | ||
import { describe, it } from "vitest" | ||
|
||
import __filename from "../../src/common/filename" | ||
|
@@ -39,6 +39,33 @@ describe(__filename(import.meta.url), () => { | |
assert.strictEqual(cleanEmail("jhönœ.dôœ.’£'^&/=!*?}ù@têst .com "), "[email protected]") | ||
}) | ||
|
||
it("Suppression des différentes formes d'URL dans un texte", () => { | ||
assert.strictEqual(removeUrlsFromText(undefined), "") | ||
assert.strictEqual(removeUrlsFromText(null), "") | ||
assert.strictEqual(removeUrlsFromText(""), "") | ||
assert.strictEqual(removeUrlsFromText("clean text"), "clean text") | ||
assert.strictEqual(removeUrlsFromText("text https://url.com end"), "text end") | ||
assert.strictEqual(removeUrlsFromText("text http://www.url.com https://url.com [email protected] end"), "text end") | ||
assert.strictEqual(removeUrlsFromText("text https://url.com www.url.com/?meh=lah mailto:[email protected] ftp://bad-ressource.com/path/path"), "text ") | ||
}) | ||
|
||
it("Mise entre [] des différentes formes d'URL dans un texte", () => { | ||
assert.strictEqual(disableUrlsWith0WidthChar(undefined), "") | ||
assert.strictEqual(disableUrlsWith0WidthChar(null), "") | ||
assert.strictEqual(disableUrlsWith0WidthChar(""), "") | ||
assert.strictEqual(disableUrlsWith0WidthChar("clean text"), "clean text") | ||
assert.strictEqual(disableUrlsWith0WidthChar("clean [email protected] text"), "clean evil-pirate@hack\u200B.\u200Bcom text") | ||
assert.strictEqual(disableUrlsWith0WidthChar("text https://url.com end"), "text https://url\u200B.\u200Bcom end") | ||
assert.strictEqual( | ||
disableUrlsWith0WidthChar("text http://www.url.com https://url.com [email protected] end"), | ||
"text http://www\u200B.\u200Burl\u200B.\u200Bcom https://url\u200B.\u200Bcom evil-pirate@hack\u200B.\u200Bcom end" | ||
) | ||
assert.strictEqual( | ||
disableUrlsWith0WidthChar("text https://url.com www.url.com/?meh=lah mailto:[email protected] ftp://bad-ressource.com/path/path"), | ||
"text https://url\u200B.\u200Bcom www\u200B.\u200Burl\u200B.\u200Bcom/?meh=lah mailto:evil@hack\u200B.\u200Bcom ftp://bad-ressource\u200B.\u200Bcom/path/path" | ||
) | ||
}) | ||
|
||
it.skip("Encryption décryption fonctionne", () => { | ||
const value = "Chaîne@crypter" | ||
|
||
|
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
Oops, something went wrong.