fix: Jen s chybějícímí údaji -> k doplnění

feat: zobrazení aktuálního počtu jídel
feat: chuť a typ receptu
This commit is contained in:
Ondřej Anděl committed 2026-10-16 08:30:18 +02:00
1 parent b637e243d5
commit 35cbc5a9ca
11 files changed
+206 -21

No files matched your search

+20 -1
View File
@@ -5,7 +5,7 @@ import { getMealGroups, renameMealGroup } from "../mealGroups";
import { getMealTemplates, saveMealTemplate } from "../mealTemplates";
import { addMealPhoto, deleteMealPhoto, getMealPhotos } from "../mealPhotos";
import { resetMemoryStorage } from "../storage/memory";
import { MealType } from "../../../types/gen/types.gen";
import { MealType, RecipeFlavor } from "../../../types/gen/types.gen";
const LOGIN = 'tester';
const IMAGE = 'data:image/jpeg;base64,AAAA';
@@ -62,6 +62,25 @@ describe('recept jídla v seznamu jídel', () => {
expect(await getMealPhotos(LOGIN, 'Rizoto', 'doma')).toHaveLength(0);
});
it('recept je bez zadané chuti slaný a typ i chuť přežijí přejmenování', async () => {
const [created] = await saveMealTemplate(LOGIN, rizoto);
expect(created).toMatchObject({ flavor: RecipeFlavor.SLANE });
expect(created).not.toHaveProperty('category');
const [saved] = await saveMealTemplate(LOGIN, {
...rizoto, id: created.id, category: ' Pečení ', flavor: RecipeFlavor.SLADKE,
});
await renameMealGroup(LOGIN, 'Rizoto', 'doma', 'Sladké rizoto', 'doma');
expect(await getMealTemplates(LOGIN)).toMatchObject([
{ id: saved.id, name: 'Sladké rizoto', category: 'Pečení', flavor: RecipeFlavor.SLADKE },
]);
});
it('odmítne neznámou chuť receptu', async () => {
await expect(saveMealTemplate(LOGIN, { ...rizoto, flavor: 'KYSELE' })).rejects.toThrow(/chuť/);
});
it('dvě jídla s recepty přejmenováním nesloučí', async () => {
await saveMealTemplate(LOGIN, rizoto);
await saveMealTemplate(LOGIN, { ...rizoto, name: 'Rizoto 2' });