2019-07-17 14:53:11 +02:00
|
|
|
import * as path from 'path'
|
|
|
|
import fs from 'fs'
|
|
|
|
import keys from 'all-object-keys'
|
|
|
|
|
2020-12-26 15:15:11 +01:00
|
|
|
const locales = ['de', 'fr', 'it', 'ja', 'ko', 'pl', 'it', 'zh_cn', 'zh_tw', 'cs', 'es_es', 'no', 'pt_pt', 'ru', 'si', 'sv_se', 'tzm']
|
2019-07-17 14:53:11 +02:00
|
|
|
|
|
|
|
describe('i18n', () => {
|
2019-07-17 15:11:07 +02:00
|
|
|
describe('should not define duplicate keys', () => {
|
2020-11-30 14:57:41 +01:00
|
|
|
locales.forEach(locale => {
|
2019-07-17 15:11:07 +02:00
|
|
|
it(`${locale} translation`, () => {
|
|
|
|
const targetJson = JSON.parse(
|
|
|
|
fs.readFileSync(path.resolve(__dirname, `../../src/config/locales/${locale}/translation.json`), 'utf8')
|
|
|
|
)
|
2019-11-18 14:36:19 +01:00
|
|
|
const allKeys = keys(targetJson)
|
2019-07-17 15:11:07 +02:00
|
|
|
const duplicates: Array<string> = allKeys.filter(
|
|
|
|
(x: string, _: number, self: Array<string>) => self.indexOf(x) !== self.lastIndexOf(x)
|
|
|
|
)
|
|
|
|
expect(duplicates).toEqual([])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
2019-07-17 14:53:11 +02:00
|
|
|
})
|