---
id: TST-ACC-TRX-060
title: Render invoice 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/invoices/render-invoice.integration.spec.js
implements:
  - ATS-ACC-TRX-005-01
implements_parts:
  - scenario: ATS-ACC-TRX-005-01
    assertion: it is the invoice’s own template over its unit’s
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/render-invoice.integration.spec.js#it
      is the invoice’s own template over its unit’s
  - scenario: ATS-ACC-TRX-005-01
    assertion: it is the business unit’s template when the invoice names none
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/render-invoice.integration.spec.js#it
      is the business unit’s template when the invoice names none
  - scenario: ATS-ACC-TRX-005-01
    assertion: it is the built-in invoice when neither the invoice nor its unit names one
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/render-invoice.integration.spec.js#it
      is the built-in invoice when neither the invoice nor its unit names one
  - scenario: ATS-ACC-TRX-005-01
    assertion: it refuses an inactive template in 1.0’s words
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/render-invoice.integration.spec.js#it
      refuses an inactive template in 1.0’s words
  - scenario: ATS-ACC-TRX-005-01
    assertion: 'it refuses a template of another kind: 400'
    provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/render-invoice.integration.spec.js#it
      refuses a template of another kind: 400
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/invoices/render-invoice.integration.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/integration/services/invoices/render-invoice.integration.spec.js
    assertion_titles:
      - rendering an invoice (integration)
      - the template
      - is the built-in invoice when neither the invoice nor its unit names one
      - is the invoice’s own template
      - is a built-in the invoice names explicitly
      - is the business unit’s template when the invoice names none
      - is the invoice’s own template over its unit’s
      - the document
      - >-
        renders the invoice’s template with the tenant, unit, number, date,
        bill-to contact, lines and balance
      - >-
        renders the built-in invoice with the tenant, the invoice’s number, the
        bill-to contact’s names and the total
      - >-
        renders the built-in invoice without its lines: the configuration
        module’s built-in comments its loop out (open item)
      - renders an organization’s invoice with the organization’s name from CRM
      - >-
        renders the latest payment allocated to the invoice, and what is paid
        and still due
      - >-
        renders a draft with the products’ names as the products module reads
        them, and no number
      - the e-mail
      - 'is the template’s own subject and body, rendered with the same data'
      - >-
        is the built-in invoice’s e-mail when the template has none (1.0’s
        default)
      - refusals
      - 'refuses a template the invoice names that does not exist: not_found'
      - 'refuses a template of another kind: 400'
      - refuses an inactive template in 1.0’s words
      - 'refuses an invoice the tenant does not have: not_found'
      - refuses another tenant’s invoice exactly as one that does not exist
    imports:
      - const chai = require('chai');
      - chai.use(require('chai-as-promised'));
      - 'const { stage } = require(''@rhythmsoftware/macroservice-testing/stage'');'
      - >-
        const { createDocumentTemplate } =
        require('../../../../../books/services/persistence/document-templates');
      - >-
        const { getBusinessUnit, updateBusinessUnit } =
        require('../../../../../books/services/persistence/business-units');
      - >-
        const { createDraft } =
        require('../../../../services/invoices/invoice-drafts');
      - >-
        const { updateDetails } =
        require('../../../../services/invoices/invoice-changes');
      - >-
        const { renderInvoice } =
        require('../../../../services/invoices/invoice-rendering');
      - >-
        const { receivePayment } =
        require('../../../../services/payments/payment-receive');
      - '} = require(''../../payments-fixtures'');'
      - 'const { putContact } = require(''../../parties-fixtures'');'
      - "\t\t\tconst { builtIn } = seeded.require();"
      - "\t\t\tconst { house } = seeded.require();"
      - "\t\t\tconst { namedBuiltIn } = seeded.require();"
      - "\t\t\tconst { unit } = seeded.require();"
      - "\t\t\tconst { unitOverridden } = seeded.require();"
      - "\t\t\tconst { house } = seeded.require();"
      - "\t\t\tconst { builtIn } = seeded.require();"
      - "\t\t\tconst { builtIn } = seeded.require();"
      - "\t\t\tconst { organization } = seeded.require();"
      - "\t\t\tconst { paid, latest } = seeded.require();"
      - "\t\t\tconst { draft } = seeded.require();"
      - "\t\t\tconst { house } = seeded.require();"
      - "\t\t\tconst { plain } = seeded.require();"
      - "\t\t\tconst { missing } = seeded.require();"
      - "\t\t\tconst { wrongKind } = seeded.require();"
      - "\t\t\tconst { inactive } = seeded.require();"
      - "\t\t\tseeded.require();"
      - "\t\t\tconst { house } = seeded.require();"
    test_double_declarations:
      - ' * stand-in tables, the shared Liquid renderer with Accounting''s filters. Doubled: nothing; CRM''s rows are the owner''s writes.'
---

# Render invoice 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 rendering selects the applicable document design. 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.
