2018-11-27 19:56:46 -05:00
|
|
|
const assert = require('assert').strict
|
|
|
|
const words = require('../src/words')
|
|
|
|
|
|
|
|
describe('Word List Tests', () => {
|
2018-12-04 18:50:30 -05:00
|
|
|
const lists = ['small', 'medium', 'large']
|
2018-11-27 19:56:46 -05:00
|
|
|
|
|
|
|
it('length', () => {
|
|
|
|
assert.equal(words.small.length, 2048, 'small list size incorrect')
|
2018-11-27 22:21:02 -05:00
|
|
|
assert.equal(words.medium.length, 4096, 'medium list size incorrect')
|
2018-12-04 18:50:30 -05:00
|
|
|
assert.equal(words.large.length, 8192, 'large list size incorrect')
|
2018-11-27 19:56:46 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
lists.forEach(name => {
|
|
|
|
it(`${name} uniqueness`, () => {
|
|
|
|
const store = {}
|
|
|
|
|
|
|
|
words[name].forEach(word => {
|
|
|
|
const key = `word_${word}`
|
|
|
|
assert(!store[key], `word ${word} is duplicated`)
|
|
|
|
store[key] = true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|