blob: 3b9a2dd3879e2358d7e547c2c49b79374adf8c67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { describe, expect, it } from 'vitest';
import { allLocales } from '../src';
import './vitest-extensions';
function checkLocaleData(data: unknown) {
if (Array.isArray(data)) {
it('should not have duplicate entries', () => {
expect(data).not.toContainDuplicates();
});
} else if (typeof data === 'object' && data != null) {
for (const [nestedKey, nestedData] of Object.entries(data)) {
describe(nestedKey, () => {
checkLocaleData(nestedData);
});
}
} else {
it.skip(`primitives cannot be tested`);
}
}
describe('locale-data', () => {
checkLocaleData(allLocales);
});
|