---
id: TST-ACC-TRX-086
title: Credits queries 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/services/persistence/credits.queries.integration.spec.js
implements: []
implements_parts: []
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/services/persistence/credits.queries.integration.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/persistence/credits.queries.integration.spec.js
    assertion_titles:
      - credit queries (integration)
      - loadCredit
      - 'answers the open credit, every column as stored'
      - >-
        answers the payment’s credit with its payment, and nothing for an absent
        or another tenant’s credit
      - listCredits
      - >-
        answers the tenant’s credits newest first, a page of two with the keyset
        of the next, then the rest
      - 'filters by status, by source and by payment'
      - listOpenCreditsOf
      - >-
        answers Ada’s open credits in alpha USD, oldest first: the open credit
        (reopened by the reversal) and the payment’s; not the used nor the void
      - answers nothing in another unit or currency
      - loadCreditApplication
      - >-
        answers the reversal’s header and its negating line, every column as
        stored
      - answers the reversed original with its reversal columns
      - listCreditApplicationsOfCredit
      - 'answers the credit’s applications oldest first, a page at a time'
      - listCreditApplicationsOfCredit by settlement (DEF-ACT-0312)
      - >-
        answers the applications of the settlement only, not a credit applied
        outside it
      - narrows by the credit as well when both are named
      - withReversingApplication (DEF-ACT-0317)
      - >-
        names the application that reversed a reversed one, and none for an
        applied one
      - listApplicationLinesOfInvoice
      - answers the invoice’s application lines across applications
    imports:
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { applyCredit, createCredit, reverseCreditApplication, voidCredit
        } = require('../../../../services/credits/credit-commands');
      - >-
        const { settle } =
        require('../../../../services/settlements/settlement-commands');
      - >-
        const { receivePayment } =
        require('../../../../services/payments/payment-receive');
      - '} = require(''../../../../services/persistence/credit-applications'');'
      - >-
        const { listCredits, listOpenCreditsOf, loadCredit } =
        require('../../../../services/persistence/credits');
      - '} = require(''../../payments-fixtures'');'
      - "\t\t\tconst { open } = world.require();"
      - "\t\t\tconst { payment, fromPayment, foreign } = world.require();"
      - "\t\t\tconst { open, used, voided, fromPayment } = world.require();"
      - "\t\t\tconst { used, voided, payment, fromPayment } = world.require();"
      - "\t\t\tconst { open, fromPayment } = world.require();"
      - "\t\t\tconst { invoice, open, reversible, reversal } = world.require();"
      - "\t\t\tconst { reversible } = world.require();"
      - "\t\t\tconst { open, reversible, reversal } = world.require();"
      - "\t\t\tconst { settled, credit } = settledWorld.require();"
      - "\t\t\tconst { settled, other } = settledWorld.require();"
      - "\t\t\tconst { reversible, reversal, applied } = world.require();"
      - "\t\t\tconst { invoice } = world.require();"
    test_double_declarations: []
---

# Credits queries 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

The executable assertions exercise this module, but no capability or feature scenario binding is established for this file. Its individual assertion titles remain in the evidence register for subsequent mapping.

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