mirror of
https://github.com/wassname/talk.git
synced 2026-07-13 17:45:56 +08:00
fix: fixed linting
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
IntermediateModerationPhase,
|
||||
IntermediatePhaseResult,
|
||||
} from "talk-server/services/comments/moderation";
|
||||
import { containsMatchingPhraseMemoized } from "talk-server/services/comments/moderation/wordlist";
|
||||
import { containsMatchingPhraseMemoized } from "talk-server/services/comments/moderation/wordList";
|
||||
|
||||
// This phase checks the comment against the wordList.
|
||||
export const wordList: IntermediateModerationPhase = ({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { containsMatchingPhrase } from "talk-server/services/comments/moderation/wordlist";
|
||||
import { containsMatchingPhrase } from "talk-server/services/comments/moderation/wordList";
|
||||
|
||||
const phrases = [
|
||||
"cookies",
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import { containsMatchingPhrase } from "talk-server/services/comments/moderation/wordlist";
|
||||
|
||||
const phrases = [
|
||||
"cookies",
|
||||
"how to do bad things",
|
||||
"how to do really bad things",
|
||||
"s h i t",
|
||||
"$hit",
|
||||
"p**ch",
|
||||
"p*ch",
|
||||
];
|
||||
|
||||
describe("containsMatchingPhrase", () => {
|
||||
it("does match on a word in the list", () => {
|
||||
[
|
||||
"how to do really bad things",
|
||||
"what is cookies",
|
||||
"cookies",
|
||||
"COOKIES.",
|
||||
"how to do bad things",
|
||||
"How To do bad things!",
|
||||
"This stuff is $hit!",
|
||||
"That's a p**ch!",
|
||||
].forEach(word => {
|
||||
expect(containsMatchingPhrase(phrases, word)).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
it("does not match on a word not in the list", () => {
|
||||
[
|
||||
"how to",
|
||||
"cookie",
|
||||
"how to be a great person?",
|
||||
"how to not do really bad things?",
|
||||
"i have $100 dollars.",
|
||||
"I have bad $ hit lling",
|
||||
"That's a p***ch!",
|
||||
].forEach(word => {
|
||||
expect(containsMatchingPhrase(phrases, word)).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
it("allows an empty list", () => {
|
||||
expect(containsMatchingPhrase([], "test")).toEqual(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user