batchCooking/apps/api/features/preferences.feature
Nicolas 3acde696f5 API: module preferences — GET/PATCH /preferences (step 2/4)
- getPreferences: SYSTEM par défaut si aucune ligne (même logique que
  dietId/allergies : absent = valeur par défaut, pas une omission)
- updatePreferences: upsert (crée la ligne au premier PATCH)
- Tests Mocha + Cucumber : 401, valeur invalide, défaut, création à la
  volée, cloisonnement entre profils
2026-08-17 15:55:45 +02:00

23 lines
1.1 KiB
Gherkin

Feature: User preferences (theme)
As a signed-in user
I want to choose a light, dark, or system theme
So that the app matches how I like to read it
Scenario: A visitor without a session cannot read preferences
When I send a GET request to "/preferences"
Then the response status should be 401
And the response error code should be "NOT_AUTHENTICATED"
Scenario: A signed-in user with no preferences yet defaults to SYSTEM
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 request my preferences
Then the response status should be 200
And my theme preference should be "SYSTEM"
Scenario: A signed-in user sets their theme preference
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 theme preference to "DARK"
Then the response status should be 200
And my theme preference should be "DARK"