mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-11-13 17:08:20 +00:00
chore: update lint rules
This commit is contained in:
@@ -15,6 +15,22 @@ function toolKeys(tool: ToolEntry): { fields: string[]; groups: string[] } {
|
||||
return { fields, groups };
|
||||
}
|
||||
|
||||
type SelectOption = { value: string; label: string };
|
||||
|
||||
function selectOptions(
|
||||
tool: ToolEntry,
|
||||
): { fieldId: string; option: SelectOption }[] {
|
||||
const result: { fieldId: string; option: SelectOption }[] = [];
|
||||
for (const [fieldId, field] of Object.entries(tool.schema?.fields ?? {})) {
|
||||
const spec = (
|
||||
field as { spec?: { kind?: string; options?: SelectOption[] } }
|
||||
).spec;
|
||||
if (spec?.kind !== "select") continue;
|
||||
for (const option of spec.options ?? []) result.push({ fieldId, option });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
describe("полнота словарей для нового registry", () => {
|
||||
it("у каждого инструмента есть перевод ru с непустыми title/description", () => {
|
||||
for (const tool of TOOLS) {
|
||||
@@ -43,6 +59,22 @@ describe("полнота словарей для нового registry", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("все active select options переведены в en и ru", () => {
|
||||
for (const tool of TOOLS) {
|
||||
for (const { fieldId, option } of selectOptions(tool)) {
|
||||
if (fieldId === "component") continue;
|
||||
const key = `${tool.id}: ${fieldId}.${option.value}`;
|
||||
expect(en.tools[tool.id]?.options?.[fieldId]?.[option.value], key).toBe(
|
||||
option.label,
|
||||
);
|
||||
expect(
|
||||
ru.tools[tool.id]?.options?.[fieldId]?.[option.value],
|
||||
key,
|
||||
).toBeTruthy();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("в словарях нет лишних инструментов", () => {
|
||||
const ids = new Set(TOOLS.map((tool) => tool.id));
|
||||
for (const dict of [ru.tools, en.tools]) {
|
||||
|
||||
Reference in New Issue
Block a user