deposits
8 requirements and 37 scenarios in openspec/specs/deposits/spec.md. A scenario’s test is test('<scenario>') inside describe('<requirement>'), in Vitest or Playwright.
A tenancy’s deposit
Section titled “A tenancy’s deposit”Playwright: e2e/deposits.spec.ts
| Scenario | Tests |
|---|---|
| Adding a tenant with a deposit | Vitest src/features/tenancies/tenancy-deposit.server.test.tsPlaywright e2e/deposits.spec.ts |
| A tenancy without a deposit | Vitest src/features/tenancies/tenancy-deposit.server.test.tsPlaywright e2e/deposits.spec.ts |
| A deposit over three months’ rent is warned about | Vitest src/features/tenancies/TenancyForm.test.tsxPlaywright e2e/deposits.spec.ts |
| An invalid deposit is refused | Vitest src/features/tenancies/TenancyForm.test.tsxVitest src/features/tenancies/schemas.test.tsPlaywright e2e/deposits.spec.ts |
| Correcting the deposit | Vitest src/features/tenancies/tenancy-deposit.server.test.tsPlaywright e2e/deposits.spec.ts |
| A member can’t set a deposit | Vitest src/features/tenancies/tenancy-deposit.server.test.ts |
The deposit on the tenancy page
Section titled “The deposit on the tenancy page”Playwright: e2e/deposits.spec.ts
| Scenario | Tests |
|---|---|
| The deposit card of the current tenancy | Vitest src/features/tenancies/TenancyPage.test.tsxPlaywright e2e/deposits.spec.ts |
| An ended tenancy’s deposit status | Vitest src/features/tenancies/TenancyPage.test.tsx |
| A member sees the deposit but can’t change it | Vitest src/features/tenancies/TenancyPage.test.tsxPlaywright e2e/deposits.spec.ts |
Recording a deposit return
Section titled “Recording a deposit return”Playwright: e2e/deposits.spec.ts
Rent kept from the deposit
Section titled “Rent kept from the deposit”No Playwright test: the allocation is a pure calculation, and its effect in the browser is shown by “Recording a deposit return”’s Playwright test, where the month the rent kept covers turns paid.
| Scenario | Tests |
|---|---|
| The rent kept pays the missing month | Vitest src/features/deposits/deposits.server.test.tsVitest src/features/deposits/deposit.test.tsPlaywright e2e/deposits.spec.ts |
| The rent kept covers the oldest months first | Vitest src/features/deposits/deposits.server.test.tsVitest src/features/deposits/deposit.test.ts |
| The rent kept can’t exceed the rent missing | Vitest src/features/deposits/deposits.server.test.tsVitest src/features/deposits/deposit.test.ts |
| The rent kept counts in the year of the return | Vitest src/features/year-summary/year-summary.server.test.tsVitest src/features/year-summary/summary.test.ts |
Correcting and deleting a deposit return
Section titled “Correcting and deleting a deposit return”Playwright: e2e/deposits.spec.ts
| Scenario | Tests |
|---|---|
| Correcting the amount kept for damage | Vitest src/features/deposits/deposits.server.test.tsPlaywright e2e/deposits.spec.ts |
| Correcting the rent kept replaces its payments | Vitest src/features/deposits/deposits.server.test.ts |
| Deleting a return removes its payments | Vitest src/features/deposits/deposits.server.test.tsPlaywright e2e/deposits.spec.ts |
| Opening the return from the correction form | Playwright e2e/deposits.spec.ts |
| The deposit can’t go below the amounts kept | Vitest src/features/tenancies/tenancy-deposit.server.test.ts |
| A member can’t delete a return | Vitest src/features/deposits/deposits.server.test.ts |
The deposit return reminder
Section titled “The deposit return reminder”Playwright: e2e/deposits.spec.ts
| Scenario | Tests |
|---|---|
| The reminder after the last rent day | Vitest src/features/tenancies/TenancyPage.test.tsxVitest src/features/deposits/deposit.test.tsPlaywright e2e/deposits.spec.ts |
| No reminder before the last rent day | Vitest src/features/tenancies/TenancyPage.test.tsxVitest src/features/deposits/deposit.test.tsPlaywright e2e/deposits.spec.ts |
| The reminder stays while a new tenant lives in the flat | Vitest src/features/tenancies/TenancyPage.test.tsx |
| A tenancy without a deposit has no reminder | Vitest src/features/tenancies/TenancyPage.test.tsxVitest src/features/deposits/deposit.test.ts |
The deposit when ending a tenancy
Section titled “The deposit when ending a tenancy”Playwright: e2e/deposits.spec.ts
| Scenario | Tests |
|---|---|
| The end form shows the deposit | Vitest src/features/tenancies/EndTenancyForm.test.tsxPlaywright e2e/deposits.spec.ts |
| No deposit, no deposit section | Vitest src/features/tenancies/EndTenancyForm.test.tsxPlaywright e2e/deposits.spec.ts |
A deposit return stays inside its tenancy
Section titled “A deposit return stays inside its tenancy”No Playwright test: server-side checks with the same forms and reason display as the tenancy forms’ browser tests; Vitest covers them.
| Scenario | Tests |
|---|---|
| Cancelling the ending of a returned tenancy is refused | Vitest src/features/tenancies/tenancy-deposit.server.test.ts |
| Moving a fixed term’s end past the return is refused | Vitest src/features/tenancies/tenancy-deposit.server.test.ts |
| Deleting a flat removes its deposit returns | Vitest src/features/deposits/deposit-return.repository.server.test.ts |