import test from "node:test"; import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import { messages } from "../src/i18n.js"; const read = (f) => readFileSync(new URL(`../src/${f}`, import.meta.url), "utf8"); test("Сценарий: подсказка про «Полегче» и «Посложнее» на всех языках", () => { for (const l of ["ru", "kk", "en"]) { for (const k of ["tuneHint", "tuneOff", "tuneDone"]) assert.ok(messages[l][k].length > 5); assert.match(messages[l].tuneDone, /\{name\}/); } assert.match(read("index.html"), /id="tuneInfo"/); }); test("Сценарий: пока блюда нет, кнопки неактивны и это объяснено", () => { const a = read("app.js"); assert.match(a, /\$\("easier"\)\.disabled = \$\("harder"\)\.disabled = !show/); assert.match(a, /t\.tuneOff/); assert.doesNotMatch(read("index.html"), /id="tune"[^>]*hidden/); assert.match(read("style.css"), /\.tune button:disabled/); }); test("Сценарий: после нажатия видно новое блюдо или сообщение, что подходящего нет", () => { const a = read("app.js"); assert.match(a, /t\.tuneDone\.replace/); assert.match(a, /showTuneError\(r\.error\)/); });