21 lines
997 B
JavaScript
21 lines
997 B
JavaScript
import test from "node:test";
|
||
import assert from "node:assert/strict";
|
||
import { readFileSync } from "node:fs";
|
||
import { messages } from "../src/i18n.js";
|
||
|
||
const html = readFileSync(new URL("../src/index.html", import.meta.url), "utf8");
|
||
|
||
test("Сценарий: каждая кнопка в разметке имеет подпись без скриптов", () => {
|
||
const buttons = [...html.matchAll(/<button\b[^>]*>([^<]*)<\/button>/g)];
|
||
// Кнопки «Рецепт», «Полегче», «Посложнее», «Назад» подписываются скриптом, только когда доступны (WTC-42).
|
||
const labeled = buttons.filter(([, text]) => text.trim().length > 0);
|
||
assert.equal(labeled.length, 2);
|
||
});
|
||
|
||
test("Сценарий: подписи в разметке совпадают с русскими текстами", () => {
|
||
const m = messages.ru;
|
||
for (const s of [m.add, m.pick, m.nameLabel]) {
|
||
assert.ok(html.includes(`>${s}<`), s);
|
||
}
|
||
});
|