forked from sindresorhus/word-list
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
50 lines (44 loc) · 825 Bytes
/
Copy pathtest.js
File metadata and controls
50 lines (44 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import fs from 'fs';
import test from 'ava';
import wordList from '.';
const badWords = [
'bumfuck',
'bumfucks',
'ass'
];
const goodWords = [
'accumulator',
'advertisement',
'album',
'assassination',
'cryptanalyst',
'anticipation',
'antisexual',
'antiterrorism',
'bumps',
'button',
'chores',
'cockiness',
'damnable',
'japan',
'illustrator',
'shell',
'pronoun',
'scrap',
'aerospace',
'backspace'
];
test('main', t => {
t.true(wordList.length > 0);
t.true(fs.statSync(wordList).size > 1000);
});
test('bad words, #2', t => {
const wordListText = fs.readFileSync(wordList, 'utf8');
const words = wordListText.split('\n');
for (const badWord of badWords) {
t.false(words.includes(badWord), badWord);
}
for (const goodWord of goodWords) {
t.true(words.includes(goodWord), goodWord);
}
});