mirror of
https://github.com/wassname/talk.git
synced 2026-08-12 12:30:39 +08:00
Merge branch 'master' into user-sort
Conflicts: client/coral-admin/src/reducers/moderation.js client/coral-embed-stream/src/actions/stream.js client/coral-embed-stream/src/components/Stream.js client/coral-framework/components/Slot.js plugin-api/beta/client/utils/index.js test/server/routes/api/account/index.js
This commit is contained in:
@@ -12,10 +12,13 @@ describe('services.Wordlist', () => {
|
||||
'cookies',
|
||||
'how to do bad things',
|
||||
'how to do really bad things',
|
||||
's h i t'
|
||||
's h i t',
|
||||
'$hit',
|
||||
'p**ch',
|
||||
'p*ch',
|
||||
],
|
||||
suspect: [
|
||||
'do bad things'
|
||||
'do bad things',
|
||||
]
|
||||
};
|
||||
|
||||
@@ -28,9 +31,19 @@ describe('services.Wordlist', () => {
|
||||
|
||||
before(() => wordlist.upsert(wordlists));
|
||||
|
||||
it('has entries', () => {
|
||||
expect(wordlist.lists.banned).to.not.be.empty;
|
||||
expect(wordlist.lists.suspect).to.not.be.empty;
|
||||
it('parses the wordlists correctly', () => {
|
||||
expect(wordlist.lists.banned).to.deep.equal([
|
||||
[ 'cookies' ],
|
||||
[ 'how', 'to', 'do', 'bad', 'things' ],
|
||||
[ 'how', 'to', 'do', 'really', 'bad', 'things' ],
|
||||
[ 's', 'h', 'i', 't' ],
|
||||
[ '$hit' ],
|
||||
[ 'p**ch' ],
|
||||
[ 'p*ch' ],
|
||||
]);
|
||||
expect(wordlist.lists.suspect).to.deep.equal([
|
||||
[ 'do', 'bad', 'things' ],
|
||||
]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -59,7 +72,9 @@ describe('services.Wordlist', () => {
|
||||
'cookies',
|
||||
'COOKIES.',
|
||||
'how to do bad things',
|
||||
'How To do bad things!'
|
||||
'How To do bad things!',
|
||||
'This stuff is $hit!',
|
||||
'That\'s a p**ch!',
|
||||
].forEach((word) => {
|
||||
expect(wordlist.match(bannedList, word)).to.be.true;
|
||||
});
|
||||
@@ -70,7 +85,10 @@ describe('services.Wordlist', () => {
|
||||
'how to',
|
||||
'cookie',
|
||||
'how to be a great person?',
|
||||
'how to not do really bad things?'
|
||||
'how to not do really bad things?',
|
||||
'i have $100 dollars.',
|
||||
'I have bad $ hit lling',
|
||||
'That\'s a p***ch!',
|
||||
].forEach((word) => {
|
||||
expect(wordlist.match(bannedList, word)).to.be.false;
|
||||
});
|
||||
@@ -78,6 +96,39 @@ describe('services.Wordlist', () => {
|
||||
|
||||
});
|
||||
|
||||
describe('#scan', () => {
|
||||
|
||||
it('does match on a bad word', () => {
|
||||
[
|
||||
'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(wordlist.scan('body', word)).to.not.be.undefined;
|
||||
});
|
||||
});
|
||||
|
||||
it('does not match on a good word', () => {
|
||||
[
|
||||
'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(wordlist.scan('body', word)).to.be.undefined;
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#checkName', () => {
|
||||
[
|
||||
'flowers',
|
||||
|
||||
Reference in New Issue
Block a user