what-to-cook/test/no-recipe-note.test.js
Peppa bf49091283
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
WTC-40: тест — пометка «Рецепта нет» только у блюд без рецепта
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 06:45:21 +05:00

17 lines
949 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 { 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);
});