Skip to content

Commit

Permalink
style: fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
jojoee committed Sep 13, 2024
1 parent ad91eb7 commit 215e3de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint no-var: 0 */
// old node.js version doesn't support let and const

/**
* LeoProfanity
*
Expand Down
24 changes: 12 additions & 12 deletions test/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-unused-expressions */
var expect = require('chai').expect;
var filter = require('../src/index.js');
const expect = require('chai').expect;
const filter = require('../src/index.js');
const enWordDictionary = require('../dictionary/default.json')

// optional dictionaries
Expand Down Expand Up @@ -208,7 +208,7 @@ describe('add', function () {

it('should not add if we already have', function () {
// check duplication
var numberOfCurrentWords = filter.list().length;
const numberOfCurrentWords = filter.list().length;
filter.add(['b@@b', 'b##b']);
expect(filter.list().length).to.equal(numberOfCurrentWords);
});
Expand All @@ -233,7 +233,7 @@ describe('reset', function () {
filter.reset();

// prepare data to test by adding new 2 bad words
var numberOfCurrentWords = filter.list().length;
const numberOfCurrentWords = filter.list().length;
filter.add(['badword1', 'badword2']);
expect(filter.list().length).to.equal(numberOfCurrentWords + 2);

Expand All @@ -252,7 +252,7 @@ describe('clearList', function () {

describe('getDictionary', function () {
it('should returns "en" word list', function () {
var result = filter.getDictionary()
const result = filter.getDictionary()

// contains words
expect(result).to.include('boob');
Expand All @@ -264,7 +264,7 @@ describe('getDictionary', function () {

if (wordDictionary['fr']) {
it('should returns "fr" word list', function () {
var result = filter.getDictionary('fr')
const result = filter.getDictionary('fr')

expect(result).to.include('1mb3c1l3');
expect(result).to.include('1mbec1l3');
Expand All @@ -273,7 +273,7 @@ describe('getDictionary', function () {

if (wordDictionary['ru']) {
it('should returns "ru" word list', function () {
var result = filter.getDictionary('ru')
const result = filter.getDictionary('ru')

expect(result).to.include('хуй');
});
Expand Down Expand Up @@ -315,8 +315,8 @@ describe('loadDictionary', function () {
describe('addDictionary', function () {
it('should add new dictionary', function () {
filter.loadDictionary();
var name = 'th';
var words = ['หนึ่ง', 'สอง', 'สาม', 'สี่', 'ห้า'];
const name = 'th';
const words = ['หนึ่ง', 'สอง', 'สาม', 'สี่', 'ห้า'];

filter.addDictionary(name, words);

Expand All @@ -326,7 +326,7 @@ describe('addDictionary', function () {

describe('removeDictionary', function () {
it('should remove existing dictionary', function () {
var name = 'fr';
const name = 'fr';
filter.loadDictionary(name);
expect(filter.list().length).to.not.equal(0);

Expand All @@ -337,8 +337,8 @@ describe('removeDictionary', function () {

it('should remove new dictionary', function () {
filter.loadDictionary()
var name = 'th'
var words = ['หนึ่ง', 'สอง', 'สาม', 'สี่', 'ห้า']
const name = 'th'
const words = ['หนึ่ง', 'สอง', 'สาม', 'สี่', 'ห้า']
filter.addDictionary(name, words);
expect(filter.list().length).to.equal(words.length);

Expand Down

0 comments on commit 215e3de

Please sign in to comment.