---
id: TST-PFM-MTD-044
title: associations in force
kind: integration
product_area: platform
module: metadata
revision: 1
status: draft
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
repository: services-platform
files:
  - modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js
implements:
  - ATS-PFM-MTD-018-02
  - ATS-PFM-MTD-018-03
  - ATS-PFM-MTD-018-04
  - ATS-PFM-MTD-018-09
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 5
isolation: >-
  Prepared integration database and the suite fixture records; fixture teardown restores or removes its own
  rows.
evidence:
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
    a second link of a one-place type that starts today, naming the link whose end date has not passed
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#keeps
    ending a link in the future from freeing its place: the end recorded today still holds until the date
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#allows
    the next link from the day after the end date
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
    a link starting on the end date itself, the end date being inclusive
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#frees
    the place on the day after an end date that has passed
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#still
    holds the place on the end date itself when that date is today
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#holds
    the one place of a one-to-one type on either side for the dates of the link
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
    a second link of one pair whose dates overlap the first, leaving the first alone
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#allows
    a second link of one pair that starts the day after the first ends
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#allows
    a link before the first and one after the last, and refuses one that spans a gap onto a neighbour
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#reads
    a null start as from the beginning: an undated link overlaps one that ended in the past
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#reads
    a null end as no end: a link with no end overlaps every link that starts after it
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
    an update that makes a link overlap another of its place, and leaves it as it was
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
    an end date later than the start of the next link of the place, and leaves the link as it was
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#lets
    a link in force be ended again, to a day the rest of its place allows
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
    two primaries of one from record whose dates overlap, and allows them when the dates do not
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#corrects
    the notes of a link that overlaps another as history, which a merge leaves, without a refusal
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#still
    refuses moving that link onto other days of the place held by the open one
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
    one of two writers of overlapping links of one pair, as a refusal and not a database error
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
    one of two writers of overlapping holders of one place when the end dates are in the future
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#lets
    two writers of adjacent links of one place both succeed
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#lists
    a link ending in the future, and one ending today, with their end dates, and leaves out one that ended
    yesterday
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#counts
    the links in force and the ended ones together against the per-record limit
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#removes
    a link that has an end date when it is deleted, correcting history, and ends one with none
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
    an endpoint deletion while a restricting link has an end date that has not passed, removing nothing
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#removes
    a restricting link whose end date passed yesterday with the record, history holding nothing
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
    turning the primary off while a primary link is in force on a future end date, and allows it once that has
    passed
fixture_imports:
  - drizzle-orm
  - '@rhythmsoftware/macroservice-testing/refusals'
  - '@rhythmsoftware/macroservice-errors/errors'
  - ../../../../db/association-types.table
  - ../../../../db/associations.table
  - ../../../../services/persistence/association-types
  - ../../../../services/persistence/associations
  - ../../support
test_doubles: []
limitations: []
unmatched_specification: null
binding_assertions:
  - scenario: ATS-PFM-MTD-018-02
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
        a second link of a one-place type that starts today, naming the link whose end date has not passed
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
        a link starting on the end date itself, the end date being inclusive
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#allows
        the next link from the day after the end date
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#frees
        the place on the day after an end date that has passed
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
  - scenario: ATS-PFM-MTD-018-03
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
        a second link of one pair whose dates overlap the first, leaving the first alone
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#allows
        a second link of one pair that starts the day after the first ends
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#reads
        a null start as from the beginning: an undated link overlaps one that ended in the past
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
        two primaries of one from record whose dates overlap, and allows them when the dates do not
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
  - scenario: ATS-PFM-MTD-018-04
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#refuses
        one of two writers of overlapping links of one pair, as a refusal and not a database error
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#lets
        two writers of adjacent links of one place both succeed
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
  - scenario: ATS-PFM-MTD-018-09
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.in-force.integration.spec.js#counts
        the links in force and the ended ones together against the per-record limit
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
---

# Associations in force

## Verification Boundary

This integration suite checks relationship definitions and links within the local test harness. The registered file and pinned revision define its boundary.

## What This Suite Proves

The bindings identify the detailed or feature scenarios whose outcomes have assertions in this suite. Original case references remain attached to the detailed scenarios so a reviewer can inspect the exact assertion. Assertions are evidence of implemented checks; no execution result is claimed.

## What It Does Not Prove

The register does not establish a current passing run or full specification conformance. Behavior outside the suite’s fixtures and assertions remains unverified.

## Real Dependencies and Test Doubles

The fixture uses PostgreSQL and the imported persistence or API code. The fixture imports identify the setup seams; this register makes no broader claim that dependencies are undoubled.

## Must Not Be Doubled

The operation under examination and its asserted stored outcomes must remain real within the declared harness. A fixture cannot replace the write, refusal or transactional effect that the bound scenario checks.
