forked from 3chospirits/badwords-filter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
22 lines (21 loc) · 880 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const Filter = require("./index.js");
const filterDefault = new Filter();
let testCases = [
"this sentence should be 100% clean",
"this sentence has one dirty word: porn",
"the filter detects duplicated letters in bad words: ppooooorrrnnnnn",
"also detects l33t attempts to bypass: p0rn",
"and ignores symbols that are not l33t: p.o~r*n",
"also works with multiple bad words in one sentence or accents: porn and héntai",
"test + test porn test"
]
testCases.forEach((c, num) => {
// num = 1;
// c = "the filter detects duplicated letters in bad words: ppooooorrrnnnnn";
console.log("\x1b[4m%s\x1b[0m", `Test Case ${num}`);
console.log(`original message:`);
console.log("\x1b[31m%s\x1b[0m", `\t${c}`);
console.log(`filtered:`);
console.log("\x1b[32m%s\x1b[0m", `\t${filterDefault.clean(c)}`);
})
console.log("\x1b[0m", "");