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

14 lines
850 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 read = (f) => readFileSync(new URL("../src/" + f, import.meta.url), "utf8");
// WTC-33: подпись «Рецепта для этого блюда пока нет» в списке и в выдаче
test("подпись без рецепта есть в выдаче и в списке", () => {
assert.equal(messages.ru.noRecipe, "Рецепта для этого блюда пока нет");
for (const l of ["ru", "kk", "en"]) assert.ok(messages[l].noRecipe, l);
assert.match(read("index.html"), /id="noRecipeToday"/);
assert.match(read("app.js"), /\$\("noRecipeToday"\)\.hidden = !\(show && !findRecipe\(state\.last\)\)/);
assert.match(read("app.js"), /t\.noRecipe/);
});