- GET/PATCH /house/current — renomme le foyer de l'utilisateur connecté.
PATCH avec houseId null -> 404 HOUSE_NOT_FOUND.
- PATCH /profile/diet { dietId: number | null } — régime du profil ;
null l'efface (étape skippable du parcours). dietId invalide ->
404 DIET_NOT_FOUND.
- GET/PATCH /profile/allergies — allergènes/intolérances, liste d'IDs ;
PATCH remplace l'ensemble complet (pas une fusion, cohérent avec un
multi-select). ID invalide -> 404 ALLERGY_NOT_FOUND.
- 3 nouveaux ErrorCode (4041-4043) + libellés fr.
- Extraction de toSafeProfile() dans src/lib/safe-profile.ts —
auparavant dupliqué dans auth.service.ts et require-auth.ts,
profile.service.ts le réutilise aussi.
- Tests Mocha (28 passing) + Cucumber (15 scenarios) — même convention
que le reste, doc README.
Deuxième commit de la feature profil/foyer/régime/allergènes —
composants front partagés dans le commit suivant.
28 lines
1.4 KiB
Gherkin
28 lines
1.4 KiB
Gherkin
Feature: Profile regime and allergens
|
|
As a signed-in user
|
|
I want to set my dietary regime and allergens/intolerances
|
|
So that the household's meal planning can account for them later
|
|
|
|
Scenario: A visitor without a session cannot set a regime
|
|
When I send a PATCH request to "/profile/diet" with body:
|
|
"""
|
|
{ "dietId": 1 }
|
|
"""
|
|
Then the response status should be 401
|
|
And the response error code should be "NOT_AUTHENTICATED"
|
|
|
|
Scenario: A signed-in user sets their regime to a valid, seeded diet
|
|
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 set my regime to "Végétarien"
|
|
Then the response status should be 200
|
|
And my profile's regime should be "Végétarien"
|
|
|
|
Scenario: A signed-in user selects allergens, then replaces the selection
|
|
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 set my allergens to "Arachides, Gluten"
|
|
Then the response status should be 200
|
|
And my selected allergens should be "Arachides, Gluten"
|
|
When I set my allergens to "Lait"
|
|
Then my selected allergens should be "Lait"
|