- Add `ConnectivityIssue.vue` component for displaying server connection issues. - Implement polling logic with retry intervals to check server health. - Update i18n with new connectivity issue messages. - Add unit tests to cover connectivity failure and recovery scenarios. - Update test suite for breadth of coverage, including router contract and timer cleanup.
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
import { join, relative } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const root = process.cwd();
|
|
const activeLocales = ["da", "en", "sv", "de", "no"];
|
|
const catalogFiles = [
|
|
...activeLocales.map((locale) => `src/i18n/source/${locale}/phrases/compat/pos/index.json`),
|
|
"src/i18n/source/global/shared/pos/index.json",
|
|
...activeLocales.map((locale) => `src/i18n/generated/${locale}-v2.json`),
|
|
"src/i18n/generated/global-v2.json",
|
|
...activeLocales.map((locale) => `src/i18n/locales/${locale}.json`),
|
|
];
|
|
const suspiciousJsonKeyPattern = /"(?:(?:\\.)|[^"\\])*(?:\?|\uFFFD|\\u[fF]{2}[fF][dD])(?:(?:\\.)|[^"\\])*"\s*:/u;
|
|
|
|
describe("i18n key integrity", () => {
|
|
it("does not contain replacement placeholders in translation key names", () => {
|
|
const failures = catalogFiles.flatMap((file) => {
|
|
const filePath = join(root, file);
|
|
const relativePath = relative(root, filePath);
|
|
const keyPaths = readFileSync(filePath, "utf8")
|
|
.split(/\r?\n/)
|
|
.flatMap((line, index) =>
|
|
suspiciousJsonKeyPattern.test(line) ? [`${relativePath}: line ${index + 1}: ${line.trim()}`] : []
|
|
);
|
|
|
|
return keyPaths;
|
|
});
|
|
|
|
expect(failures).toEqual([]);
|
|
});
|
|
});
|