35 lines
971 B
TypeScript
35 lines
971 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { t } from '../translations';
|
|
|
|
describe('Translations', () => {
|
|
it('should have exactly the same keys in English and Czech', () => {
|
|
const enKeys = Object.keys(t.en).sort();
|
|
const csKeys = Object.keys(t.cs).sort();
|
|
|
|
expect(enKeys).toEqual(csKeys);
|
|
|
|
// Deep check for nested keys
|
|
for (const key of enKeys) {
|
|
const enSubKeys = Object.keys((t.en as any)[key]).sort();
|
|
const csSubKeys = Object.keys((t.cs as any)[key]).sort();
|
|
|
|
expect(enSubKeys).toEqual(csSubKeys);
|
|
}
|
|
});
|
|
|
|
it('should not have empty translation strings', () => {
|
|
const checkEmpty = (obj: any) => {
|
|
for (const val of Object.values(obj)) {
|
|
if (typeof val === 'string') {
|
|
expect(val.length).toBeGreaterThan(0);
|
|
} else if (typeof val === 'object') {
|
|
checkEmpty(val);
|
|
}
|
|
}
|
|
};
|
|
|
|
checkEmpty(t.en);
|
|
checkEmpty(t.cs);
|
|
});
|
|
});
|