what-to-cook/test/empty-recipe-hint.test.js
2026-11-16 06:37:21 +05:00

14 lines
833 B
JavaScript
Raw Permalink 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";
// WTC-26: на пустом экране объяснено и про кнопку «Рецепт», и про «Рецепта нет»
test("Сценарий: Пустой экран объясняет оба случая", () => {
const app = readFileSync(new URL("../src/app.js", import.meta.url), "utf8");
assert.match(app, /\$\("noRecipeHint"\)\.hidden = n !== 0 && !hasNoRecipe\(/);
assert.match(messages.ru.recipeExampleHint, /кнопка «Рецепт»/);
assert.match(messages.ru.noRecipeHint, /«Рецепта для этого блюда пока нет»/);
for (const l of ["ru", "kk", "en"]) assert.ok(messages[l].noRecipeHint.length > 20, l);
});