Recipe catalog v2: - Recipe gagne visibility (PERSONAL/HOUSE/PUBLIC), authorId, authorHouseId - Favoris par utilisateur (RecipeFavorite), régimes associés (RecipeDiet) - Aliments "pas aimés" par utilisateur (UserProfileDislikedIngredient), distinct des allergies médicales - API: GET /recipes?tab=favoris|perso|foyer|publique avec contrôle d'accès complet, POST/DELETE /recipes/:id/favorite, édition/suppression réservées à l'auteur (403 NOT_RECIPE_AUTHOR), GET/PATCH /profile/disliked-ingredients - Frontend: vue maître-détail (onglets + tableau + panneau détail), formulaire enrichi (visibilité, régimes), section préférences pour les aliments pas aimés Catalogue d'ingrédients de référence: - Extension du seed de 39 à ~430 ingrédients (viandes, poissons/fruits de mer, légumes, fruits, féculents, condiments/sauces, épices/herbes, pains à sandwich, cuisines italienne/asiatique/mexicaine/maghrébine, liquides et boissons de cuisine, bouillons/fonds) - Chaque ingrédient lié à ses allergènes UE (IngredientAllergy) — les 14 allergènes réglementaires restent tous couverts - Seeding optimisé en requêtes groupées (createMany/diff ciblé) plutôt qu'un upsert par ligne, pour garder resetDatabase() rapide en test Tests: 102 tests Mocha + 32 scénarios BDD, tous verts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
59 lines
3.8 KiB
Gherkin
59 lines
3.8 KiB
Gherkin
Feature: Recipe catalog
|
|
As a signed-in user
|
|
I want to browse, create and manage recipes
|
|
So that the household can plan meals from a shared catalog
|
|
|
|
Scenario: A visitor without a session cannot browse the catalog
|
|
When I request the recipe catalog
|
|
Then the response status should be 401
|
|
And the response error code should be "NOT_AUTHENTICATED"
|
|
|
|
Scenario: A signed-in user creates a recipe with an ingredient and a step
|
|
Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
And I log in with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
When I create a recipe named "Ratatouille" with ingredient "Tomate" and step "Couper les légumes"
|
|
Then the response status should be 201
|
|
And the created recipe should have ingredient "Tomate" and step "Couper les légumes"
|
|
|
|
Scenario: Creating a recipe with an unknown ingredient is rejected
|
|
Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
And I log in with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
When I create a recipe named "Ratatouille" with unknown ingredient id 999999 and step "Couper les légumes"
|
|
Then the response status should be 404
|
|
And the response error code should be "INGREDIENT_NOT_FOUND"
|
|
|
|
Scenario: A signed-in user sees their own recipe in the "perso" tab
|
|
Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
And I log in with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
And a recipe named "Ratatouille" already exists with ingredient "Tomate" and step "Couper les légumes"
|
|
When I request the recipe catalog tab "perso"
|
|
Then the response status should be 200
|
|
And the recipe catalog response should include "Ratatouille"
|
|
|
|
Scenario: A signed-in user favorites a recipe and finds it in the "favoris" tab
|
|
Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
And I log in with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
And a recipe named "Ratatouille" already exists with ingredient "Tomate" and step "Couper les légumes"
|
|
When I favorite the recipe named "Ratatouille"
|
|
And I request the recipe catalog tab "favoris"
|
|
Then the response status should be 200
|
|
And the recipe catalog response should include "Ratatouille"
|
|
|
|
Scenario: Only a recipe's author can edit it
|
|
Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
And I log in with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
And a public recipe named "Ratatouille" already exists with ingredient "Tomate" and step "Couper les légumes"
|
|
And a profile already exists with email "bob@example.com" and password "correct-horse-battery-staple"
|
|
And the second user logs in with email "bob@example.com" and password "correct-horse-battery-staple"
|
|
When the second user tries to modify the recipe named "Ratatouille"
|
|
Then the second user's response status should be 403
|
|
And the second user's response error code should be "NOT_RECIPE_AUTHOR"
|
|
|
|
Scenario: Deleting a recipe still used by a planning item is rejected
|
|
Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
And I log in with email "alice@example.com" and password "correct-horse-battery-staple"
|
|
And a recipe named "Ratatouille" already exists with ingredient "Tomate" and step "Couper les légumes"
|
|
And my household has a planning that uses the recipe named "Ratatouille"
|
|
When I delete the recipe named "Ratatouille"
|
|
Then the response status should be 409
|
|
And the response error code should be "RECIPE_IN_USE"
|