recurring-amounts
13 requirements and 65 scenarios in openspec/specs/recurring-amounts/spec.md. A scenario’s test is test('<scenario>') inside describe('<requirement>'), in Vitest or Playwright.
The financing charge treatment
Section titled “The financing charge treatment”Playwright: e2e/recurring-amounts.spec.ts
| Scenario | Tests |
|---|---|
| Setting the treatment for the first time | Playwright e2e/recurring-amounts.spec.ts |
| A new treatment keeps the history | Vitest src/features/recurring-amounts/recurring-amounts.server.test.tsPlaywright e2e/recurring-amounts.spec.ts |
| A member can’t set the treatment | Vitest src/features/recurring-amounts/recurring-amounts.server.test.ts |
Accumulated capitalised financing charges
Section titled “Accumulated capitalised financing charges”Playwright: e2e/recurring-amounts.spec.ts
| Scenario | Tests |
|---|---|
| Only capitalised months count | Vitest src/features/recurring-amounts/periods.test.tsPlaywright e2e/recurring-amounts.spec.ts |
| All financing charges count | Vitest src/features/recurring-amounts/periods.test.ts |
| Months without a treatment don’t count | Vitest src/features/recurring-amounts/periods.test.ts |
Undoing the latest treatment change
Section titled “Undoing the latest treatment change”Playwright: e2e/recurring-amounts.spec.ts
| Scenario | Tests |
|---|---|
| Undoing a treatment change | Vitest src/features/recurring-amounts/recurring-amounts.server.test.tsPlaywright e2e/recurring-amounts.spec.ts |
| Undoing the only treatment | Vitest src/features/recurring-amounts/recurring-amounts.server.test.ts |
| No treatment to undo is refused | Vitest src/features/recurring-amounts/recurring-amounts.server.test.ts |
| A member can’t undo the treatment | Vitest src/features/recurring-amounts/recurring-amounts.server.test.ts |
Charges of a month
Section titled “Charges of a month”No Playwright test: a pure calculation from the periods; Vitest covers it, and the charges page shows it in the browser test of “The charges page”.
| Scenario | Tests |
|---|---|
| A year’s charges up to the current month | Vitest src/features/recurring-amounts/charges.test.ts |
| An earlier year starts from the first charge | Vitest src/features/recurring-amounts/charges.test.ts |
| A change shows the previous amount | Vitest src/features/recurring-amounts/charges.test.ts |
| The first month of a charge is not a change | Vitest src/features/recurring-amounts/charges.test.ts |
| Several financing charges in a year | Vitest src/features/recurring-amounts/charges.test.ts |
| The financing charge by treatment when it changes mid-year | Vitest src/features/recurring-amounts/charges.test.ts |
| A financing charge without a treatment | Vitest src/features/recurring-amounts/charges.test.ts |
| The whole-year estimate includes a change set for later in the year | Vitest src/features/recurring-amounts/charges.test.ts |
| No estimate in December | Vitest src/features/recurring-amounts/charges.test.ts |
| The years since the first charge | Vitest src/features/recurring-amounts/charges.test.ts |
| Charges set only from a later month | Vitest src/features/recurring-amounts/charges.test.ts |
The charges page
Section titled “The charges page”Playwright: e2e/charges.spec.ts
| Scenario | Tests |
|---|---|
| The current year’s charges by month | Playwright e2e/charges.spec.ts |
| Choosing an earlier year | Playwright e2e/charges.spec.ts |
| A line for each financing charge | Playwright e2e/charges.spec.ts |
| A member sees the charges | Playwright e2e/charges.spec.ts |
| A flat without charges | Playwright e2e/charges.spec.ts |
| A member of a flat without charges | Playwright e2e/charges.spec.ts |
| Another user can’t open the charges page | Playwright e2e/charges.spec.ts |
Adding a financing charge
Section titled “Adding a financing charge”Playwright: e2e/recurring-amounts.spec.ts
| Scenario | Tests |
|---|---|
| Adding a second financing charge | Vitest src/features/recurring-amounts/recurring-amounts.server.test.tsPlaywright e2e/recurring-amounts.spec.ts |
| A financing charge needs a name | Vitest src/features/recurring-amounts/schemas.test.ts |
| A name already in use is refused | Vitest src/features/recurring-amounts/recurring-amounts.server.test.tsPlaywright e2e/recurring-amounts.spec.ts |
| A new charge’s date before the flat’s ownership is refused | Vitest src/features/recurring-amounts/recurring-amounts.server.test.ts |
| A member can’t add a financing charge | Vitest src/features/recurring-amounts/recurring-amounts.server.test.ts |
Renaming a financing charge
Section titled “Renaming a financing charge”Playwright: e2e/recurring-amounts.spec.ts
| Scenario | Tests |
|---|---|
| Naming the unnamed charge | Vitest src/features/recurring-amounts/recurring-amounts.server.test.ts |
| Changing the case of a name | Vitest src/features/recurring-amounts/recurring-amounts.server.test.tsPlaywright e2e/recurring-amounts.spec.ts |
| Another flat’s charge is not found | Vitest src/features/recurring-amounts/recurring-amounts.server.test.ts |
| A member can’t rename a financing charge | Vitest src/features/recurring-amounts/recurring-amounts.server.test.ts |
Ending a financing charge
Section titled “Ending a financing charge”Playwright: e2e/recurring-amounts.spec.ts
| Scenario | Tests |
|---|---|
| Ending a charge from next year | Playwright e2e/recurring-amounts.spec.ts |
| An ended charge is listed apart | Playwright e2e/recurring-amounts.spec.ts |
| Undoing an ending | Vitest src/features/recurring-amounts/recurring-amounts.server.test.tsPlaywright e2e/recurring-amounts.spec.ts |
Existing financing charges become unnamed charges
Section titled “Existing financing charges become unnamed charges”No Playwright test: a one-time database migration; a Workers test applies it to data stored in the previous schema.
| Scenario | Tests |
|---|---|
| A flat’s financing charge periods move to one unnamed charge | Vitest src/features/recurring-amounts/financing-charges-migration.server.test.ts |
| A flat without a financing charge gets none | Vitest src/features/recurring-amounts/financing-charges-migration.server.test.ts |
Charges are recorded as monthly periods
Section titled “Charges are recorded as monthly periods”No Playwright test: these are rules for stored periods and pure calculations; Vitest covers them with the functions and the repository, and the browser tests of the other requirements use them.
| Scenario | Tests |
|---|---|
| A month’s amount comes from the period containing its first day | Vitest src/features/recurring-amounts/periods.test.ts |
| A new amount ends the previous period the month before | Vitest src/features/recurring-amounts/recurring-amount.repository.server.test.ts |
| Each financing charge has its own periods | Vitest src/features/recurring-amounts/recurring-amount.repository.server.test.ts |
| A date that isn’t the first of a month is refused | Vitest src/features/recurring-amounts/periods.test.ts |
| An invalid amount is refused | Vitest src/features/recurring-amounts/schemas.test.ts |
The charge amounts page
Section titled “The charge amounts page”Playwright: e2e/recurring-amounts.spec.ts
| Scenario | Tests |
|---|---|
| Opening the charge amounts page from the details page | Playwright e2e/recurring-amounts.spec.ts |
| A flat without amounts | Vitest src/features/recurring-amounts/RecurringAmountsPage.test.tsxPlaywright e2e/recurring-amounts.spec.ts |
| The current amount and an upcoming change | Vitest src/features/recurring-amounts/RecurringAmountsPage.test.tsxPlaywright e2e/recurring-amounts.spec.ts |
| Several financing charges with their sum | Vitest src/features/recurring-amounts/RecurringAmountsPage.test.tsxPlaywright e2e/recurring-amounts.spec.ts |
| A member sees the amounts but can’t change them | Vitest src/features/recurring-amounts/RecurringAmountsPage.test.tsxPlaywright e2e/recurring-amounts.spec.ts |
Setting a charge
Section titled “Setting a charge”Playwright: e2e/recurring-amounts.spec.ts
Undoing the latest charge change
Section titled “Undoing the latest charge change”Playwright: e2e/recurring-amounts.spec.ts
| Scenario | Tests |
|---|---|
| Undoing a charge increase | Vitest src/features/recurring-amounts/recurring-amounts.server.test.tsPlaywright e2e/recurring-amounts.spec.ts |
| Undoing the only maintenance charge | Vitest src/features/recurring-amounts/recurring-amounts.server.test.tsPlaywright e2e/recurring-amounts.spec.ts |
| Undoing a financing charge’s only amount removes it | Vitest src/features/recurring-amounts/recurring-amounts.server.test.tsPlaywright e2e/recurring-amounts.spec.ts |
| Nothing to undo is refused | Vitest src/features/recurring-amounts/recurring-amounts.server.test.ts |