mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
fix(string utils): do not escape possible regular expressions
This commit is contained in:
12
test/api/unit/libs/stringUtils.test.js
Normal file
12
test/api/unit/libs/stringUtils.test.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { getMatchesByWordArray } from '../../../../website/server/libs/stringUtils';
|
||||
import bannedWords from '../../../../website/server/libs/bannedWords';
|
||||
|
||||
describe('stringUtils', () => {
|
||||
describe('getMatchesByWordArray', () => {
|
||||
it('check all banned words are matched', async () => {
|
||||
const message = bannedWords.join(',');
|
||||
const matches = getMatchesByWordArray(message, bannedWords);
|
||||
expect(matches.length).to.equal(bannedWords.length);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user