WTC-40: тест — пометка «Рецепта нет» только у блюд без рецепта
All checks were successful
peppa/lint lint: success за 0с
peppa/test test: success за 1с
peppa/build build: success за 0с
ci / checks (pull_request) Successful in 4s
deploy / deploy (pull_request) Successful in 8s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Peppa 2026-11-16 06:45:21 +05:00
parent 432eaf9482
commit bf49091283

View File

@ -0,0 +1,16 @@
import test from "node:test";
import assert from "node:assert/strict";
import { messages } from "../src/i18n.js";
import { findRecipe } from "../src/recipes.js";
import { catalog } from "../src/catalog.js";
// WTC-40: пометка «Рецепта нет» только у блюд без рецепта
test("у своего блюда нет рецепта, пометка простыми словами", () => {
assert.ok(!findRecipe("Моё секретное блюдо"));
assert.match(messages.ru.noRecipe, /Рецепта для этого блюда пока нет/);
assert.doesNotMatch(messages.ru.noRecipe, /null|undefined|error|ошибк/i);
});
test("у блюд с рецептом из базы пометки нет, будет кнопка «Рецепт»", () => {
const names = Array.isArray(catalog) ? catalog : [];
const withRecipe = names.filter((n) => findRecipe(n));
assert.ok(withRecipe.length > 0);
});