---
id: TST-PFM-MTD-045
title: associations
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.integration.spec.js
implements:
  - ATS-PFM-MTD-017-02
  - ATS-PFM-MTD-018-01
  - ATS-PFM-MTD-018-03
  - ATS-PFM-MTD-018-04
  - ATS-PFM-MTD-018-05
  - ATS-PFM-MTD-018-06
  - ATS-PFM-MTD-018-07
  - ATS-PFM-MTD-018-08
  - 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.integration.spec.js
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#creates
    an association with the type’s object ids, open and at version 1
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#derives
    the to key from a one-to-many type and leaves the from key empty
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#derives
    both keys from a one-to-one type
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a type the tenant does not have
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a from record that does not exist, writing nothing
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a to record that does not exist
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a record of another tenant, which the tenant policy never lets the seam see
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a record associated with itself
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#accepts
    two contacts of a same-object type (Contact mentors Contact)
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a second open association of one type between one pair, leaving the first alone
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a second open owner of a one-to-many type’s to record, naming it
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#accepts
    many to records of one from record on a one-to-many type
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a second association of a one-to-one type’s from record, naming it
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    dates on an undated type
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    an end before the start on a dated type
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a date that is not a calendar day
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a primary on a type that has none
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a second open primary of one from record and type
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    an association past the per-record limit of the type, writing nothing
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#leaves
    the boat with one open owner when two owners are written at once
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    the losing writer as a cardinality conflict, not as a database error
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#replaces
    the notes and position at the version read
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    a stale version and leaves the association as it was
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#ends
    an open association of a dated type today in the tenant’s zone when no day is given
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#ends
    on the day given
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    an end before the association started, leaving it open
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    to end an association that already ended
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    to end an association of an undated type
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#keeps
    a boat’s past owner and its current one: an owner ended, a new one added
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    reopening an ended association while another holds the place it would take
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#deletes
    an association of an undated type
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#ends,
    rather than deletes, an open association of a dated type
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#deletes
    an ended association of a dated type, correcting its history
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#removes
    the associations of a detaching type on both sides of the deleted record
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
    the deletion while an open association of a restricting side exists, removing nothing
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#removes
    an ended association of a restricting side, history restricting nothing
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#answers
    the record on the other side of a cascading side, for the owner to delete
  - >-
    services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#removes
    nothing and cascades nothing for a record no association names
fixture_imports:
  - drizzle-orm
  - '@rhythmsoftware/macroservice-testing/refusals'
  - '@rhythmsoftware/macroservice-errors/errors'
  - ../../../../db/association-types.table
  - ../../../../db/associations.table
  - ../../../../services/persistence/associations
  - ../../support
test_doubles: []
limitations: []
unmatched_specification: null
binding_assertions:
  - scenario: ATS-PFM-MTD-017-02
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#accepts
        two contacts of a same-object type (Contact mentors Contact)
    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-01
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        a type the tenant does not have
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        a from record that does not exist, writing nothing
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        a record of another tenant, which the tenant policy never lets the seam see
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        a record associated with itself
    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.integration.spec.js#refuses
        a second open owner of a one-to-many type’s to record, naming it
    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.integration.spec.js#leaves
        the boat with one open owner when two owners are written at once
    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-05
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        dates on an undated type
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        an end before the start on a dated type
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        a date that is not a calendar day
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        a primary on a type that has none
    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-06
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        a stale version and leaves the association as it was
    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-07
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#ends
        an open association of a dated type today in the tenant’s zone when no day is given
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        an end before the association started, leaving it open
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        to end an association that already ended
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#refuses
        to end an association of an undated type
    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-08
    provenance: test
    source:
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#ends,
        rather than deletes, an open association of a dated type
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#deletes
        an ended association of a dated type, correcting its history
      - >-
        services-platform:modules/associations/tests/integration/services/persistence/associations.integration.spec.js#deletes
        an association of an undated type
    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.integration.spec.js#refuses
        an association past the per-record limit of the type, writing nothing
    note: >-
      These references identify the assertions this suite contributes; bindings to additional suites remain
      part of the scenario’s proof.
---

# Associations

## 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.
