fix: Updated shared design test for i18n structure
This commit is contained in:
parent
b7b543fda0
commit
e6b80ff0dd
2 changed files with 21 additions and 12 deletions
|
@ -99,7 +99,7 @@ export const testPatternConfig = (Pattern) => {
|
|||
const draft = new Pattern({
|
||||
measurements: requested,
|
||||
}).draft()
|
||||
|
||||
console.log(draft.setStores[0].logs)
|
||||
const missWarnings = draft.setStores[0].logs.warn.filter((w, i, a) => {
|
||||
return w.match(/tried to access `measurements/) && a.indexOf(w) === i
|
||||
})
|
||||
|
|
|
@ -61,17 +61,26 @@ export const testPatternI18n = (Pattern, i18n) => {
|
|||
expect(typeof i18n.en.o[key].d).to.equal('string')
|
||||
expect(i18n.en.o[key].d.length).to.be.above(1)
|
||||
})
|
||||
if (key.slice(-3) === 'Yes') {
|
||||
it(` - The Yes translation of boolean option o.${key} should have a corresponding No translation`, () => {
|
||||
expect(typeof i18n.en.o[key.slice(0, -3) + 'No'].t).to.equal('string')
|
||||
})
|
||||
} else if (key.slice(-2) === 'No') {
|
||||
it(` - The No translation of boolean option o.${key} should have a corresponding Yes translation`, () => {
|
||||
expect(typeof i18n.en.o[key.slice(0, -2) + 'Yes'].t).to.equal('string')
|
||||
})
|
||||
} else {
|
||||
it(` - The translation of o.${key} should correspond to a known option`, () => {
|
||||
expect(options.includes(key)).to.equal(true)
|
||||
if (key.split('.').length === 1) {
|
||||
// Regular option
|
||||
if (key.slice(-3) === 'Yes') {
|
||||
it(` - The Yes translation of boolean option o.${key} should have a corresponding No translation`, () => {
|
||||
expect(typeof i18n.en.o[key.slice(0, -3) + 'No'].t).to.equal('string')
|
||||
})
|
||||
} else if (key.slice(-2) === 'No') {
|
||||
it(` - The No translation of boolean option o.${key} should have a corresponding Yes translation`, () => {
|
||||
expect(typeof i18n.en.o[key.slice(0, -2) + 'Yes'].t).to.equal('string')
|
||||
})
|
||||
} else {
|
||||
it(` - The translation of o.${key} should correspond to a known option`, () => {
|
||||
expect(options.includes(key)).to.equal(true)
|
||||
})
|
||||
}
|
||||
} else if (key.split('.').length === 2) {
|
||||
// Entry of a list option
|
||||
const [option, entry] = key.split('.')
|
||||
it(` - The translation of o.${option} list option should have a transaltion for the ${entry} entry`, () => {
|
||||
expect(Pattern.patternConfig.options[option].list.includes(entry)).to.equal(true)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue