// DIK-23: главная без служебных фраз, всё подписано, тексты на одном языке. import { test } from "node:test"; import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; const html = readFileSync(new URL("../public/index.html", import.meta.url), "utf8"); const tr = (l) => JSON.parse(readFileSync(new URL(`../public/i18n/${l}.json`, import.meta.url), "utf8")); test("сценарий «Нет служебных фраз»: на главной нет Esil и Almaty", () => { for (const l of ["ru", "kk", "en"]) { const t = tr(l); for (const [k, v] of Object.entries(t)) { if (typeof v === "string" && !k.startsWith("adm")) assert.doesNotMatch(v, /\b(esil|almaty)\b/i, `${l}.${k}`); } } assert.doesNotMatch(html, /\b(esil|almaty)\b/i); }); test("сценарий «Всё подписано»: у кнопок есть текст или подпись, у полей — label", () => { for (const m of html.matchAll(/]*)>([\s\S]*?)<\/button>/g)) { assert.match(m[1] + m[2], /data-i=|data-al=|aria-label=|>[^<\s][^<]* { assert.match(html, /