---
id: ATS-MBR-MEM-014
scope: CAP-MBR-MEM-014
product_area: membership
module: memberships
revision: 1
status: proposed
approved_by:
approved_at:
source_sha:
  services-membership: 5994c270e8a37a30f848e99ba5b5ee6b87c08893
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
scenarios:
  - id: ATS-MBR-MEM-014-01
    title: "Only unrenewed principal terms ending inside the horizon are expiring"
    level: api
    proves:
      - BR-CAP-MBR-MEM-014-01
    preconditions: "The well-known FAA workspace fixtures, or a workspace the test builds from them."
    steps: "Sweep with terms ending inside and outside the horizon, a renewed one, and with a wider workspace horizon."
    expected: "Items open only for unrenewed terms inside the horizon; the wider horizon reaches further."
    negative: false
    data_needs: "FAA programs, packages, units and members from the integration seed."
    bound_to:
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#publishes an open item for a membership whose term ends inside the horizon"
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#publishes nothing for a term that ends outside the horizon"
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#publishes nothing for a term that already has a successor"
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#publishes a term the tenant’s wider horizon reaches"
    provenance: test
    source: "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#publishes an open item for a membership whose term ends inside the horizon"
  - id: ATS-MBR-MEM-014-02
    title: "The horizon is the workspace's own business dates"
    level: unit
    proves:
      - BR-CAP-MBR-MEM-014-02
    preconditions: "The well-known FAA workspace fixtures, or a workspace the test builds from them."
    steps: "Compute the window across a year end and either side of the workspace's midnight."
    expected: "Both ends included, on the workspace's dates, moving at its midnight."
    negative: false
    data_needs: "FAA programs, packages, units and members from the integration seed."
    bound_to:
      - "services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#is the business date through the date plus the horizon, both inclusive"
      - "services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#crosses a year end"
      - "services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#starts on the tenant’s business date, not the UTC date"
      - "services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#moves to the next day once the tenant’s midnight passes"
    provenance: test
    source: "services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#is the business date through the date plus the horizon, both inclusive"
  - id: ATS-MBR-MEM-014-03
    title: "Each alert is labelled, carries its facts and goes to the renewals responsibility"
    level: unit
    proves:
      - BR-CAP-MBR-MEM-014-03
    preconditions: "The well-known FAA workspace fixtures, or a workspace the test builds from them."
    steps: "Build the item for a named member and for one CRM names no one for."
    expected: "Keyed by the membership, labelled by name or number, with the declared facts, addressed to the default responsibility."
    negative: false
    data_needs: "FAA programs, packages, units and members from the integration seed."
    bound_to:
      - "services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#is keyed by the membership and about it, labelled with the member’s name"
      - "services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#carries the declared facts"
      - "services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#is labelled by the membership number when CRM names no one"
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#addresses the item to membership.renewals, the definition’s default"
    provenance: test
    source: "services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#is keyed by the membership and about it, labelled with the member’s name"
  - id: ATS-MBR-MEM-014-04
    title: "Alerts are scoped by the member's units, then the workspace"
    level: api
    proves:
      - BR-CAP-MBR-MEM-014-04
    preconditions: "The well-known FAA workspace fixtures, or a workspace the test builds from them."
    steps: "Publish items for a chapter member and a member of no unit."
    expected: "The chapter member's item is scoped chapter, zone, region, then workspace; the other by the workspace alone."
    negative: false
    data_needs: "FAA programs, packages, units and members from the integration seed."
    bound_to:
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#scopes the item by the membership’s chapter and its ancestors, most specific first, then the tenant"
      - "services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#is scoped by the tenant alone when the membership has no unit"
    provenance: test
    source: "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#scopes the item by the membership’s chapter and its ancestors, most specific first, then the tenant"
  - id: ATS-MBR-MEM-014-05
    title: "An alert is due on the last day and expires thirty days later"
    level: api
    proves:
      - BR-CAP-MBR-MEM-014-05
    preconditions: "The well-known FAA workspace fixtures, or a workspace the test builds from them."
    steps: "Publish an item and read its instants."
    expected: "Due at the start of the term's last day in the workspace's zone; expiring thirty days later."
    negative: false
    data_needs: "FAA programs, packages, units and members from the integration seed."
    bound_to:
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#is due at the start of the term’s last day and expires thirty days after it"
    provenance: test
    source: "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#is due at the start of the term’s last day and expires thirty days after it"
  - id: ATS-MBR-MEM-014-06
    title: "The daily sweep refreshes and clears its alerts"
    level: api
    proves:
      - BR-CAP-MBR-MEM-014-06
    preconditions: "The well-known FAA workspace fixtures, or a workspace the test builds from them."
    steps: "Run two passes, the second after the term leaves the horizon."
    expected: "The second pass refreshes the same item, then clears it; each pass is stamped."
    negative: false
    data_needs: "FAA programs, packages, units and members from the integration seed."
    bound_to:
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#refreshes the same item’s facts on the next pass rather than opening another"
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#resolves the item cleared on the next pass once its term leaves the horizon"
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#stamps the pass with what it published"
    provenance: test
    source: "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#refreshes the same item’s facts on the next pass rather than opening another"
  - id: ATS-MBR-MEM-014-07
    title: "Renewal and termination resolve the alert in their own transactions"
    level: api
    proves:
      - BR-CAP-MBR-MEM-014-07
    preconditions: "The well-known FAA workspace fixtures, or a workspace the test builds from them."
    steps: "Renew one expiring member and terminate another."
    expected: "The first item is resolved renewed and the second terminated, in the writes' transactions."
    negative: false
    data_needs: "FAA programs, packages, units and members from the integration seed."
    bound_to:
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#resolves the item renewed in the staff renewal’s transaction"
      - "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#resolves the item terminated in the termination’s transaction"
    provenance: test
    source: "services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#resolves the item renewed in the staff renewal’s transaction"
  - id: ATS-MBR-MEM-014-08
    title: "A refused alert fails its business write, and nothing is published while switched off"
    level: api
    proves:
      - BR-CAP-MBR-MEM-014-09
    preconditions: "The well-known FAA workspace fixtures, or a workspace the test builds from them."
    steps: "Switch publishing off and renew; switch it on with an unregistered definition and renew."
    expected: "Off: the renewal succeeds and nothing is published. On and refused: the renewal fails with the refusal."
    negative: true
    data_needs: "FAA programs, packages, units and members from the integration seed."
    bound_to: []
    provenance: proposed
    source: "services-membership:docs/attention.md#3. When items are published and resolved"
evidence:
  - "services-membership at 5994c270e8a37a30f848e99ba5b5ee6b87c08893: the capability sources and the bound test files."
---

# Alert staff to memberships about to expire: Acceptance Test Set

## Coverage

| Rule | Proved by |
|---|---|
| `BR-CAP-MBR-MEM-014-01` | `ATS-MBR-MEM-014-01` |
| `BR-CAP-MBR-MEM-014-02` | `ATS-MBR-MEM-014-02` |
| `BR-CAP-MBR-MEM-014-03` | `ATS-MBR-MEM-014-03` |
| `BR-CAP-MBR-MEM-014-04` | `ATS-MBR-MEM-014-04` |
| `BR-CAP-MBR-MEM-014-05` | `ATS-MBR-MEM-014-05` |
| `BR-CAP-MBR-MEM-014-06` | `ATS-MBR-MEM-014-06` |
| `BR-CAP-MBR-MEM-014-07` | `ATS-MBR-MEM-014-07` |
| `BR-CAP-MBR-MEM-014-09` | `ATS-MBR-MEM-014-08` |
