---
id: TST-ACC-BKS-052
title: Document Templates API suite
kind: api-lifecycle
product_area: accounting
module: books
revision: 1
status: draft
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
repository: services-accounting
files:
  - modules/books/tests/e2e/document-templates.e2e.spec.js
implements:
  - ATS-ACC-BKS-014-01
  - ATS-ACC-BKS-014-02
  - ATS-ACC-BKS-014-03
  - ATS-ACC-BKS-014-04
  - ATS-ACC-BKS-014-05
  - ATS-ACC-BKS-014-06
  - ATS-ACC-BKS-015-04
  - ATS-ACC-BKS-015-05
  - ATS-ACC-BKS-017-01
  - ATS-ACC-BKS-017-05
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 5
isolation: >-
  The suite owns isolated workspace identities and database fixtures; cleanup
  removes only its seeded records.
assertion_bindings:
  - scenario: ATS-ACC-BKS-014-01
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      409 to a change of kind, which is write-once
  - scenario: ATS-ACC-BKS-014-02
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 with the renderer’s sentence for Handlebars pasted into the body
  - scenario: ATS-ACC-BKS-014-02
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 naming the line and column of Liquid that cannot be read
  - scenario: ATS-ACC-BKS-014-02
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 for a variable the kind does not provide, where it is read
  - scenario: ATS-ACC-BKS-014-02
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 for a filter Accounting does not have
  - scenario: ATS-ACC-BKS-014-03
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 naming the e-mail body for a subject without one
  - scenario: ATS-ACC-BKS-014-03
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 to an e-mail on a batch download
  - scenario: ATS-ACC-BKS-014-03
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 naming the reply-to address when it is not an address
  - scenario: ATS-ACC-BKS-014-04
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#sends
      a statement to all contacts when send_to is not stated
  - scenario: ATS-ACC-BKS-014-04
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#keeps
      a statement’s contact roles when it sends to contact roles
  - scenario: ATS-ACC-BKS-014-04
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 to contact roles a statement does not send to
  - scenario: ATS-ACC-BKS-014-05
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      409 to a replacement of a built-in
  - scenario: ATS-ACC-BKS-014-05
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      409 to deleting a built-in
  - scenario: ATS-ACC-BKS-014-05
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 to an id a built-in owns
  - scenario: ATS-ACC-BKS-014-05
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#copies
      a built-in into a new, active tenant template with the built-in’s content
  - scenario: ATS-ACC-BKS-014-06
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#renders
      an invoice body and its e-mail with the sample invoice, escaping it as
      HTML
  - scenario: ATS-ACC-BKS-014-06
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#names
      the merge fields that rendered empty
  - scenario: ATS-ACC-BKS-014-06
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      an unknown variable with where it is read, and still renders the other
      parts
  - scenario: ATS-ACC-BKS-014-06
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#renders
      a batch download and its file name at the detail level asked for,
      unescaped
  - scenario: ATS-ACC-BKS-015-04
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 to a business unit naming a template of another kind
  - scenario: ATS-ACC-BKS-015-04
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 to a business unit naming an inactive template
  - scenario: ATS-ACC-BKS-015-04
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 to a business unit naming a built-in, which null already means
  - scenario: ATS-ACC-BKS-015-04
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      400 to settings naming a template that is not a statement
  - scenario: ATS-ACC-BKS-015-05
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#lists
      each template with who uses it: the unit by id and name, the settings
  - scenario: ATS-ACC-BKS-015-05
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      409 to deleting the default statement template, naming the settings
  - scenario: ATS-ACC-BKS-015-05
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      409 to deactivating the business unit’s template
  - scenario: ATS-ACC-BKS-017-01
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      the defaults at version 0
  - scenario: ATS-ACC-BKS-017-05
    source: >-
      services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js#answers
      409 to settings saved at a stale version
unmapped: false
evidence:
  - provenance: test
    source: 'services-accounting:modules/books/tests/e2e/document-templates.e2e.spec.js'
execution_notes: >-
  The file exists at the pinned revision; this registration records no execution
  result.
---

# Document Templates API suite

## Verification Boundary

The suite sends requests through the local Accounting handler and enforcing route dispatcher. PostgreSQL stores the run-owned configuration and applies its database safeguards.

## What This Suite Proves

The individual assertion references identify the acceptance outcomes this file exercises. When a scenario spans several suites, this file supplies only its listed assertions; qualification must include the other bindings and any recorded coverage finding.

## What It Does Not Prove

Local database execution does not prove deployed infrastructure, external provider availability or console behavior. No result is claimed for the pinned revision until the suite runs and its evidence is reviewed.

## Real Dependencies and Test Doubles

PostgreSQL, migrations and the exercised persistence paths are real. Test-owned execution contexts, clocks and local Platform records supply deterministic setup; the file’s imports and fixtures identify any additional doubles.

## Must Not Be Doubled

The database constraints, transaction paths and production persistence functions named by the assertions must remain real. A memory store cannot establish the recorded database proof.
