---
id: TST-ACC-TRX-028
title: Transactions view suite
kind: integration
product_area: accounting
module: transactions
revision: 1
status: draft
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
repository: services-accounting
files:
  - >-
    modules/transactions/tests/integration/db/transactions-view.integration.spec.js
implements:
  - ATS-ACC-TRX-016-06
implements_parts:
  - scenario: ATS-ACC-TRX-016-06
    assertion: >-
      it answers tenant B’s reader its own invoice alone, its customer’s name
      null where CRM has no such contact
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/db/transactions-view.integration.spec.js#it
      answers tenant B’s reader its own invoice alone, its customer’s name null
      where CRM has no such contact
  - scenario: ATS-ACC-TRX-016-06
    assertion: it answers a query reader in no tenant nothing at all
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/db/transactions-view.integration.spec.js#it
      answers a query reader in no tenant nothing at all
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 3
isolation: >-
  Suite-marked records in the prepared local test database; fixture teardown
  removes owned records.
provenance: test
source: >-
  services-accounting:modules/transactions/tests/integration/db/transactions-view.integration.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/db/transactions-view.integration.spec.js
    assertion_titles:
      - the transactions views (integration)
      - accounting.transactions_v
      - >-
        answers one row per document of tenant A, of the four kinds of this
        phase, and no other
      - >-
        answers an open invoice billed to a contact with every column, its money
        in major units
      - >-
        answers an organization’s invoice owing less than its total as partially
        paid, the organization its one customer reference
      - 'answers a draft with no number and no batch, owing its total'
      - >-
        answers an issued pro forma as pro_forma, numbered, open and with no
        batch
      - >-
        answers the credit memo with the invoice’s customer, its own memo, no
        due date and nothing open
      - answers the debit memo at its total
      - 'answers the write-off at its total, its reason as its memo'
      - >-
        answers tenant B’s reader its own invoice alone, its customer’s name
        null where CRM has no such contact
      - answers a query reader in no tenant nothing at all
      - the kind views
      - >-
        answers the organization’s invoice in invoices_v with its source and its
        open amount
      - >-
        answers the four invoices of tenant A in invoices_v, and none of tenant
        B’s
      - answers the credit memo in credit_memos_v with its invoice and reason
      - answers the debit memo in debit_memos_v with its invoice and reason
      - >-
        answers the write-off in write_offs_v, its reason as its memo and its
        reason
      - answers tenant B’s reader none of tenant A’s memos or write-offs
    imports:
      - 'const { expect } = require(''chai'');'
      - 'const { sql } = require(''drizzle-orm'');'
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { fixtureDb, ready, testId } =
        require('../../../../books/tests/integration/support');
      - >-
        const { createCreditMemo, createDebitMemo } =
        require('../../../services/change-memos/memo-commands');
      - >-
        const { createWriteOff } =
        require('../../../services/write-offs/write-off-commands');
      - >-
        const { issueInvoice } =
        require('../../../services/invoices/invoice-issue');
      - >-
        const { putContact, putOrganization, removeTenantParties } =
        require('../parties-fixtures');
      - >-
        const { createMemoWorld, ctxFor, draftInvoice, issuedInvoice,
        removeMemoWorld } = require('../memos-fixtures');
      - "\t\t\tseeded.require();"
      - "\t\t\tconst { open, society, creditMemo, debitMemo, writeOff, draft, proForma } = seeded.require();"
      - "\t\t\t\t\t.require()"
      - "\t\t\tconst { open } = seeded.require();"
      - "\t\t\texpect(read.require().byId.get(`invoice:${open.id}`)).to.deep.equal({"
      - "\t\t\tconst { society } = seeded.require();"
      - "\t\t\texpect(read.require().byId.get(`invoice:${society.id}`)).to.deep.equal({"
      - "\t\t\tconst { draft } = seeded.require();"
      - "\t\t\texpect(read.require().byId.get(`invoice:${draft.id}`)).to.deep.include({"
      - "\t\t\tconst { proForma } = seeded.require();"
      - "\t\t\texpect(read.require().byId.get(`invoice:${proForma.id}`)).to.deep.include({"
      - "\t\t\tconst { creditMemo } = seeded.require();"
      - "\t\t\texpect(read.require().byId.get(`credit_memo:${creditMemo.id}`)).to.deep.equal({"
      - "\t\t\tconst { debitMemo } = seeded.require();"
      - "\t\t\texpect(read.require().byId.get(`debit_memo:${debitMemo.id}`)).to.deep.include({"
      - "\t\t\tconst { writeOff } = seeded.require();"
      - "\t\t\texpect(read.require().byId.get(`write_off:${writeOff.id}`)).to.deep.include({"
      - "\t\t\tconst { other } = seeded.require();"
      - "\t\t\tseeded.require();"
      - "\t\t\tconst { society } = seeded.require();"
      - "\t\t\tconst { open, society, draft, proForma } = seeded.require();"
      - "\t\t\tconst { society, creditMemo } = seeded.require();"
      - "\t\t\tconst { society, debitMemo } = seeded.require();"
      - "\t\t\tconst { society, writeOff } = seeded.require();"
      - "\t\t\tseeded.require();"
    test_double_declarations:
      - ' *   stand-in, read through CRM''s grant to the reader; as two references, the contact''s id on a contact-owned row with the'
      - ' * Real: PostgreSQL, the migration''s views and grants, row-level security (CRM''s stand-in''s included), the commands. Doubled:'
      - ' * CRM''s tables (the local stand-in, written by the owner as CRM''s seeds would be).'
---

# Transactions view suite

## Verification Boundary

The suite exercises transaction commands and database protections in the local prepared test environment. Registration records the existing executable file; it does not report a run or establish product approval.

## What This Suite Proves

Its cited assertions contribute evidence for dataset context restricts visible rows. The structured assertion bindings identify which parts of combined scenarios it executes.

## What It Does Not Prove

Local commands and route invocations do not establish deployed routing, live processor guarantees or the complete staff browser experience. An unbound feature chain remains proposed, and this registration carries no execution result.

## Real Dependencies and Test Doubles

The suite uses the imported commands, route handlers or persistence code against the local test database. Fixture helpers supply accounting context; any stepped clock, dummy processor or substituted external client is retained in the evidence declarations.

## Must Not Be Doubled

The command or persistence behavior under assertion and its relevant database protections must remain real. Substituting the final financial result removes evidence of transactional effects.
