diff --git a/test/index.js b/test/index.js index 819438d..f613fb8 100644 --- a/test/index.js +++ b/test/index.js @@ -1,21 +1,8 @@ const test = require('ava'); const lexicon = require('..'); +const dictionaries = require('../src/dictionary'); -const langs = [ - 'common', - 'darnassian', - 'draconic', - 'draenei', - 'dwarven', - 'eredun', - 'gnomish', - 'gutterspeak', - 'kalimag', - 'orcish', - 'taurahe', - 'thalassian', - 'zandali' -]; +const langs = Object.keys(dictionaries); test('Should be able to translate the loaded languages', t => { for (const lang of langs) { @@ -42,3 +29,16 @@ test('Should throw an error when traslating to a non-existent language', t => { test('Should translate', t => { t.truthy(lexicon.translate('dwarven', 'Test')); }); + +test('Dictionary words should be trimmed', t => { + for (const lang of langs) { + const lengths = Object.keys(dictionaries[lang]); + + for (let length of lengths) { + const words = dictionaries[lang][length]; + length = Number(length); + + t.true(words.every(word => word.length === word.trim().length), `Not trimmed word in ${length}:${lang}`); + } + } +});