Skip to content

Commit

Permalink
feat: add common language
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarocastro committed May 8, 2021
1 parent 882a9dd commit 9459f4a
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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}`);
}
}
});

0 comments on commit 9459f4a

Please sign in to comment.