diff --git a/test/server/services/wordlist.js b/test/server/services/wordlist.js index 6d0116e26..19545ff3e 100644 --- a/test/server/services/wordlist.js +++ b/test/server/services/wordlist.js @@ -13,6 +13,7 @@ describe('services.Wordlist', () => { 's h i t', '$hit', 'p**ch', + 'p*ch', ], suspect: [ 'do bad things', @@ -36,6 +37,7 @@ describe('services.Wordlist', () => { [ 's', 'h', 'i', 't' ], [ '$hit' ], [ 'p**ch' ], + [ 'p*ch' ], ]); expect(wordlist.lists.suspect).to.deep.equal([ [ 'do', 'bad', 'things' ], @@ -84,6 +86,7 @@ describe('services.Wordlist', () => { '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; }); @@ -91,6 +94,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',