chore: Add test for duplicate locale keys

This commit is contained in:
Blade Barringer
2016-08-31 21:25:08 -05:00
parent e65f27fb69
commit ebef5ad60c

View File

@@ -0,0 +1,27 @@
'use strict';
let glob = require('glob').sync;
describe('Locales files', () => {
it.skip('do not contain duplicates of any keys', () => {
let translationFiles = glob('./common/locales/en/*.json');
if (translationFiles.length === 0) {
throw new Error('Could not find any files in ./common/locales/en/*.json');
}
let keys = {};
translationFiles.forEach((file) => {
let json = require(`../.${file}`); // eslint-disable-line global-require
Object.keys(json).forEach((key) => {
if (keys[key]) {
throw new Error(`${key} in ${file} already exists in ${keys[key]}.`);
}
keys[key] = file;
});
});
});
});