- 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
67 lines
4.1 KiB
Gherkin
67 lines
4.1 KiB
Gherkin
Feature: Household
|
|
As a signed-in user
|
|
I want to name my household, invite others to it, and manage its members
|
|
So that my whole household can share the same planning
|
|
|
|
Scenario: A visitor without a session cannot read the household
|
|
When I send a GET request to "/house/current"
|
|
Then the response status should be 401
|
|
And the response error code should be "NOT_AUTHENTICATED"
|
|
|
|
Scenario: A signed-in user creates a household
|
|
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 household named "Chez Alice"
|
|
Then the response status should be 201
|
|
And my household should be named "Chez Alice"
|
|
|
|
Scenario: A signed-in user renames their household
|
|
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 I have a household named "Foyer de test"
|
|
When I rename my household to "Chez les Martin"
|
|
Then the response status should be 200
|
|
And my household should be named "Chez les Martin"
|
|
|
|
Scenario: A second user joins a household using its invite code
|
|
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 I have a household named "Chez Alice"
|
|
And a profile already exists with email "bob@example.com" and password "correct-horse-battery-staple"
|
|
When the second user logs in with email "bob@example.com" and password "correct-horse-battery-staple"
|
|
And the second user joins my household using its invite code
|
|
Then the second user's response status should be 200
|
|
And the second user should be a member of my household
|
|
|
|
Scenario: A non-admin member cannot delete the household
|
|
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 I have a household named "Chez Alice"
|
|
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"
|
|
And the second user joins my household using its invite code
|
|
When the second user tries to delete the household
|
|
Then the second user's response status should be 403
|
|
And the second user's response error code should be "NOT_HOUSE_ADMIN"
|
|
|
|
Scenario: Adminship transfers to the remaining member when the admin leaves
|
|
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 I have a household named "Chez Alice"
|
|
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"
|
|
And the second user joins my household using its invite code
|
|
When I leave the household
|
|
Then the response status should be 204
|
|
And the second user should be the household's admin
|
|
|
|
Scenario: The admin removes a member
|
|
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 I have a household named "Chez Alice"
|
|
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"
|
|
And the second user joins my household using its invite code
|
|
When I remove the second user from my household
|
|
Then the response status should be 200
|
|
And the second user should have no household
|