2019-07-17 14:53:11 +02:00
|
|
|
import * as path from 'path'
|
|
|
|
import fs from 'fs'
|
|
|
|
import keys from 'all-object-keys'
|
|
|
|
|
2019-08-12 08:52:30 +02:00
|
|
|
const locales = ['de', 'fr', 'it', 'ja', 'ko', 'pl', 'zh_cn']
|
2019-07-17 14:53:11 +02:00
|
|
|
|
|
|
|
describe('i18n', () => {
|
2019-07-17 15:11:07 +02:00
|
|
|
describe('should not define duplicate keys', () => {
|
|
|
|
locales.map(locale => {
|
|
|
|
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
|
|
|
})
|