Files
Scott Anderson 7e25f6b910 Enable @total-typescript/ts-reset (#1761)
## Description:

Enable `@total-typescript/ts-reset`

Fixes #1760

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [ ] I have read and accepted the CLA agreement (only required once).
2025-08-09 02:13:56 -04:00

37 lines
914 B
TypeScript

import fs from "fs";
import path from "path";
import { z } from "zod";
describe("LangCode Filename Check", () => {
const langDir = path.join(__dirname, "../resources/lang");
test("lang_code matches filename", () => {
const files = fs
.readdirSync(langDir)
.filter((file) => file.endsWith(".json"));
if (files.length === 0) {
console.log("No resources/lang/*.json files found. Skipping check.");
return;
}
const schema = z.object({
lang: z.object({
lang_code: z.string(),
}),
});
for (const file of files) {
const filePath = path.join(langDir, file);
const jsonData = schema.parse(
JSON.parse(fs.readFileSync(filePath, "utf-8")),
);
const fileNameWithoutExt = path.basename(file, ".json");
const langCode = jsonData.lang?.lang_code;
expect(fileNameWithoutExt).toBe(langCode);
}
});
});