-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathtest.js
52 lines (46 loc) · 945 Bytes
/
test.js
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
51
52
import fs from 'node:fs';
import test from 'ava';
import wordList from './index.js';
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', t => {
const wordListText = fs.readFileSync(wordList, 'utf8');
const words = wordListText.split('\n');
for (const badWord of badWords) {
// eslint-disable-next-line ava/assertion-arguments
t.false(words.includes(badWord), badWord);
}
for (const goodWord of goodWords) {
// eslint-disable-next-line ava/assertion-arguments
t.true(words.includes(goodWord), goodWord);
}
});