mirror of
https://github.com/DeNNiiInc/Connect-5.git
synced 2026-04-19 13:46:00 +00:00
Add complete multiplayer system with real-time gameplay, challenge system, and 50x50 board option
This commit is contained in:
28
node_modules/bad-words/test/addWords.js
generated
vendored
Normal file
28
node_modules/bad-words/test/addWords.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
require('assert');
|
||||
var Filter = require('../lib/badwords.js'),
|
||||
filter = new Filter(),
|
||||
assert = require('better-assert');
|
||||
|
||||
describe('filter', function(){
|
||||
describe('addWords',function(){
|
||||
it('Should append words to the filter list.', function(){
|
||||
filter.addWords('dog', 'go');
|
||||
assert(filter.clean('Go dog go') === '** *** **');
|
||||
});
|
||||
|
||||
it('Should append words to the filter using an array', () => {
|
||||
let addWords = ['go', 'dog'];
|
||||
filter = new Filter()
|
||||
filter.addWords(...addWords);
|
||||
assert(filter.clean('Go dog go') === '** *** **');
|
||||
});
|
||||
|
||||
it('Should allow a list to be passed to the constructor', function() {
|
||||
filter = new Filter({
|
||||
list: ['dog']
|
||||
});
|
||||
|
||||
assert(filter.clean('Go dog go') === 'Go *** go');
|
||||
});
|
||||
});
|
||||
});
|
||||
47
node_modules/bad-words/test/filter.js
generated
vendored
Normal file
47
node_modules/bad-words/test/filter.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
require('assert');
|
||||
var Filter = require('../lib/badwords.js'),
|
||||
filter = new Filter(),
|
||||
assert = require('better-assert');
|
||||
|
||||
describe('filter', function(){
|
||||
describe('clean',function(){
|
||||
it('Should replace a bad word within a sentence asterisks (******)',function(){
|
||||
console.log(filter.clean('Don\'t be an ash0le'));
|
||||
assert(filter.clean('Don\'t be an ash0le') === 'Don\'t be an ******');
|
||||
|
||||
});
|
||||
|
||||
it('Should replace multiple instances of any bad words within a sentence asterisks (******)',function(){
|
||||
assert(filter.clean('cnts ash0le knob xxx') === '**** ****** **** ***');
|
||||
});
|
||||
|
||||
it('Should not replace anything within a sentence if there are no bad words',function(){
|
||||
assert(filter.clean('The cat ran fast') === 'The cat ran fast');
|
||||
});
|
||||
|
||||
it('Should replace a string with proper placeholder when overridden', function(){
|
||||
var customFilter = new Filter({ placeHolder: 'x'});
|
||||
assert(customFilter.clean('This is a hells good test') === 'This is a xxxxx good test');
|
||||
});
|
||||
|
||||
it('Should allow an instance of filter with an empty blacklist', function() {
|
||||
var customFilter = new Filter({
|
||||
emptyList: true
|
||||
});
|
||||
assert(customFilter.clean('This is a hells good test') === 'This is a hells good test');
|
||||
});
|
||||
|
||||
it('Should tokenize words according to regex word boundaries',function(){
|
||||
assert(filter.clean('what a bitch...fuck you') === 'what a *****...**** you');
|
||||
assert(filter.clean('<p>Don\'t be an asshole</p>') === '<p>Don\'t be an *******</p>');
|
||||
});
|
||||
|
||||
xit('Should filter words that are derivatives of words from the filter blacklist', function() {
|
||||
assert(filter.clean('shitshit') === '********');
|
||||
});
|
||||
|
||||
it('Shouldn\'t filter words that aren\'t profane.', function() {
|
||||
assert(filter.clean('hello there') === 'hello there');
|
||||
});
|
||||
});
|
||||
});
|
||||
44
node_modules/bad-words/test/isProfane.js
generated
vendored
Normal file
44
node_modules/bad-words/test/isProfane.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
require('assert');
|
||||
var Filter = require('../lib/badwords.js'),
|
||||
filter = new Filter(),
|
||||
assert = require('better-assert');
|
||||
|
||||
describe('filter', function(){
|
||||
describe('isProfane',function(){
|
||||
it("Should detect a bad word and return a boolean value",function(){
|
||||
assert(filter.isProfane("ash0le"));
|
||||
});
|
||||
|
||||
it("Should return false when no bad word is detected",function(){
|
||||
assert(filter.isProfane("wife") === false);
|
||||
});
|
||||
|
||||
it("Should be able to detect a bad word in a sentence",function(){
|
||||
assert(filter.isProfane("that person is an ash0le"));
|
||||
});
|
||||
|
||||
it('Filters out special characters appropriately', function() {
|
||||
assert(filter.isProfane("You're an asshole^ you are"));
|
||||
});
|
||||
|
||||
it('Should detect filtered words from badwords-list', function(){
|
||||
assert(filter.isProfane('willies'));
|
||||
});
|
||||
|
||||
it('Should detect filtered words regardless of type case', function() {
|
||||
var filter = new Filter({
|
||||
list: ['Test']
|
||||
});
|
||||
assert(filter.isProfane('test'));
|
||||
});
|
||||
|
||||
it('Should tokenize words according to regex word boundaries', function() {
|
||||
assert(filter.isProfane("that person is an\nasshole"));
|
||||
});
|
||||
|
||||
it('Should detect bad word phrases', function () {
|
||||
filter.addWords('oh no');
|
||||
assert(filter.isProfane("oh no! this is profane!"));
|
||||
});
|
||||
});
|
||||
});
|
||||
24
node_modules/bad-words/test/options.js
generated
vendored
Normal file
24
node_modules/bad-words/test/options.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
require('assert');
|
||||
var Filter = require('../lib/badwords.js'),
|
||||
assert = require('better-assert');
|
||||
|
||||
describe('options', function() {
|
||||
describe('split regex', function() {
|
||||
|
||||
it('default value', function() {
|
||||
filter = new Filter();
|
||||
filter.addWords('français');
|
||||
assert(filter.clean('fucking asshole') == '******* *******');
|
||||
assert(filter.clean('mot en français') == 'mot en français');
|
||||
});
|
||||
|
||||
it('override value', function() {
|
||||
filter = new Filter({splitRegex: / /});
|
||||
filter.addWords('français');
|
||||
assert(filter.clean('fucking asshole') == '******* *******');
|
||||
assert(filter.clean('mot en français') == 'mot en *******');
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
21
node_modules/bad-words/test/removeWords.js
generated
vendored
Normal file
21
node_modules/bad-words/test/removeWords.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
require('assert');
|
||||
var Filter = require('../lib/badwords.js'),
|
||||
filter = new Filter(),
|
||||
assert = require('better-assert');
|
||||
|
||||
describe('filter', () => {
|
||||
describe('removeWords',() => {
|
||||
it('Should allow you to remove words from the filter blacklist and no longer filter them (case-insensitive)', () => {
|
||||
filter.removeWords('Hells');
|
||||
assert(filter.clean('This is a hells good test') === 'This is a hells good test');
|
||||
});
|
||||
|
||||
it ('Should allow you to remove an array of words from the filter blacklist and no longer filter them', () => {
|
||||
let removingWords = ['hells', 'sadist'];
|
||||
|
||||
filter = new Filter();
|
||||
filter.removeWords(...removingWords);
|
||||
assert(filter.clean('This is a hells sadist test') === 'This is a hells sadist test');
|
||||
});
|
||||
});
|
||||
});
|
||||
12
node_modules/bad-words/test/replaceWord.js
generated
vendored
Normal file
12
node_modules/bad-words/test/replaceWord.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
require('assert');
|
||||
var Filter = require('../lib/badwords.js'),
|
||||
filter = new Filter(),
|
||||
assert = require('better-assert');
|
||||
|
||||
describe('filter', function(){
|
||||
describe('replaceWord',function(){
|
||||
it("Should replace a bad word with asterisks (******)",function(){
|
||||
assert(filter.replaceWord("ash0le") == '******');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user