what-to-cook/test/labels.test.js
Peppa e2f0c9066d
All checks were successful
peppa/lint lint: success за 0с
peppa/test test: success за 0с
peppa/build build: success за 0с
ci / checks (pull_request) Successful in 4s
deploy / deploy (pull_request) Successful in 13s
WTC-31: подписи кнопок и поля прямо в разметке
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 06:35:03 +05:00

20 lines
841 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)];
assert.equal(buttons.length, 6);
for (const [, text] of buttons) assert.ok(text.trim().length > 0);
});
test("Сценарий: подписи в разметке совпадают с русскими текстами", () => {
const m = messages.ru;
for (const s of [m.add, m.pick, m.easier, m.harder, m.back, m.recipe, m.nameLabel]) {
assert.ok(html.includes(`>${s}<`), s);
}
});