batchCooking/apps/api/features/auth.feature
Nicolas 3363cfad75 Tests API: couverture Mocha + Cucumber pour le foyer et la suppression de compte (step 4/8)
- house.test.ts réécrit (le foyer n'est plus auto-créé) + POST /house,
  POST /house/join, POST /house/leave, DELETE /house/current,
  DELETE /house/members/:id
- auth.test.ts: signup renvoie houseId=null, DELETE /auth/me (mauvais
  mot de passe, suppression, transfert d'admin)
- planning.test.ts/steps.ts: création explicite du foyer (POST /house)
- household.feature: scénarios créer/rejoindre/quitter/supprimer/
  retirer un membre, via un second agent (CustomWorld.secondAgent)
- auth.feature: scénarios de suppression de compte
2026-08-17 10:40:23 +02:00

50 lines
2.6 KiB
Gherkin

Feature: Account creation and login
As a new user
I want to create a profile and log in
So that I can access my household's batch-cooking planning
Scenario: A visitor creates a new profile
When I sign up with the following details:
| firstName | Alice |
| lastName | Martin |
| email | alice@example.com |
| password | correct-horse-battery-staple |
Then the response status should be 201
And I am authenticated as "alice@example.com"
Scenario: A visitor cannot sign up twice with the same email
Given a profile already exists with email "alice@example.com"
When I sign up with the following details:
| firstName | Alice |
| lastName | Martin |
| email | alice@example.com |
| password | correct-horse-battery-staple |
Then the response status should be 409
And the response error code should be "EMAIL_ALREADY_IN_USE"
Scenario: A registered user logs in with correct credentials
Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple"
When I log in with email "alice@example.com" and password "correct-horse-battery-staple"
Then the response status should be 200
And I am authenticated as "alice@example.com"
Scenario: A registered user cannot log in with the wrong password
Given a profile already exists with email "alice@example.com" and password "correct-horse-battery-staple"
When I log in with email "alice@example.com" and password "wrong-password"
Then the response status should be 401
And the response error code should be "INVALID_CREDENTIALS"
Scenario: A signed-in user cannot delete their account with the wrong password
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 delete my account with password "wrong-password"
Then the response status should be 401
And the response error code should be "INVALID_CREDENTIALS"
And I am authenticated as "alice@example.com"
Scenario: A signed-in user deletes their account
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 delete my account with password "correct-horse-battery-staple"
Then the response status should be 204
And I am no longer authenticated