---
id: TST-ACC-BAT-085
title: Batch integration batches
kind: integration
product_area: accounting
module: batches
revision: 1
status: draft
product_intent: proposed
implementation_evidence: observed
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
repository: services-accounting
files:
  - >-
    modules/batches/tests/integration/services/persistence/batches.integration.spec.js
implements:
  - ATS-ACC-BAT-001-02
  - ATS-ACC-BAT-001-03
  - ATS-ACC-BAT-001-04
  - ATS-ACC-BAT-001-05
  - ATS-ACC-BAT-001-07
  - ATS-ACC-BAT-003-03
  - ATS-ACC-BAT-003-05
  - ATS-ACC-BAT-003-06
  - ATS-ACC-BAT-003-07
  - ATS-ACC-BAT-003-08
  - ATS-ACC-BAT-004-01
  - ATS-ACC-BAT-004-02
  - ATS-ACC-BAT-004-03
  - ATS-ACC-BAT-004-06
  - ATS-ACC-BAT-005-01
  - ATS-ACC-BAT-005-02
  - ATS-ACC-BAT-005-03
  - ATS-ACC-BAT-005-04
  - ATS-ACC-BAT-006-02
  - ATS-ACC-BAT-006-03
  - ATS-ACC-BAT-006-06
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 its test workspace or fixed integration fixtures in the
  prepared local database.
assertion_sources:
  - scenario: ATS-ACC-BAT-001-02
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      a name another batch of the unit has 409, name_in_use, in 1.0’s sentence
      (D14)
  - scenario: ATS-ACC-BAT-001-02
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#creates
      a batch of another unit with a name the first unit uses
  - scenario: ATS-ACC-BAT-001-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#takes
      the fiscal year and period of the date, the unit’s base currency, and
      opens a transaction batch
  - scenario: ATS-ACC-BAT-001-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      a date no fiscal year of the unit holds
  - scenario: ATS-ACC-BAT-001-04
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      a date in a closed period
  - scenario: ATS-ACC-BAT-001-05
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      a currency other than the unit’s base currency
  - scenario: ATS-ACC-BAT-001-05
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#takes
      the fiscal year and period of the date, the unit’s base currency, and
      opens a transaction batch
  - scenario: ATS-ACC-BAT-001-07
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#gives
      the batch an id of its unit’s prefix and a UUID
  - scenario: ATS-ACC-BAT-001-07
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      an id already in use
  - scenario: ATS-ACC-BAT-003-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      moving the date of a posted batch, and the batch keeps its date and fiscal
      period (DEF-ACT-0502)
  - scenario: ATS-ACC-BAT-003-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      renaming a downloaded batch
  - scenario: ATS-ACC-BAT-003-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      editing the description of an archived batch
  - scenario: ATS-ACC-BAT-003-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#still
      unarchives an archived batch: its named status action is not an edit
  - scenario: ATS-ACC-BAT-003-05
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#writes
      the fields given and moves the fiscal period with the date
  - scenario: ATS-ACC-BAT-003-05
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      moving an open batch’s date into a closed period (journey 0516/0520
      setups: the rule stands)
  - scenario: ATS-ACC-BAT-003-06
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      a rename to a name another batch of the unit has 409, name_in_use (D14)
  - scenario: ATS-ACC-BAT-003-06
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#keeps
      its own name through a change of another field
  - scenario: ATS-ACC-BAT-003-07
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      a change at a version the batch has moved on from
  - scenario: ATS-ACC-BAT-003-08
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      an edit of a locked batch
  - scenario: ATS-ACC-BAT-003-08
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      an edit sent with the lock’s release
  - scenario: ATS-ACC-BAT-003-08
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#releases
      the lock with {sys_locked: null}, keeping the external id, and the batch
      can then be edited and archived
  - scenario: ATS-ACC-BAT-004-01
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      closing a batch that is not open
  - scenario: ATS-ACC-BAT-004-02
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#clears
      the errors of an errored batch on reopen, so the open batch carries none
      (journey ACT-ACC-0521)
  - scenario: ATS-ACC-BAT-004-02
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      reopening a batch that is open
  - scenario: ATS-ACC-BAT-004-02
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      reopening an archived batch: it is unarchived instead
  - scenario: ATS-ACC-BAT-004-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#archives
      an open batch and a closed one, and unarchives to open
  - scenario: ATS-ACC-BAT-004-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      archiving a posted batch 409
  - scenario: ATS-ACC-BAT-004-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#drops
      an archived batch’s automatic close, as an automatic close is kept only on
      an open batch
  - scenario: ATS-ACC-BAT-004-06
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      archiving a batch locked against updates 409
  - scenario: ATS-ACC-BAT-005-01
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#keeps
      a one-occurrence schedule of the batch at that minute, in the tenant’s
      zone
  - scenario: ATS-ACC-BAT-005-02
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#closes
      the batch when its schedule runs, and keeps the ended schedule with the
      batch
  - scenario: ATS-ACC-BAT-005-02
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#skips
      a run whose batch is no longer open
  - scenario: ATS-ACC-BAT-005-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#submits
      one posting job of the closed batch, in its unit, for the tenant’s
      customer (D13)
  - scenario: ATS-ACC-BAT-005-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#posts
      nothing more when the same occurrence runs again: the batch is no longer
      open
  - scenario: ATS-ACC-BAT-005-04
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#removes
      the schedule and the time when the batch is closed
  - scenario: ATS-ACC-BAT-005-04
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#drops
      an archived batch’s automatic close, as an automatic close is kept only on
      an open batch
  - scenario: ATS-ACC-BAT-005-04
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#deletes
      an empty batch with its automatic close’s schedule
  - scenario: ATS-ACC-BAT-006-02
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#refuses
      deleting a posted batch
  - scenario: ATS-ACC-BAT-006-03
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#answers
      409 naming the batch for every table whose restrict foreign key names a
      batch, never a 500 (DEF-ACT-0012)
  - scenario: ATS-ACC-BAT-006-06
    provenance: test
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#deletes
      the batch a recurring batch names as its active batch and clears the
      reference (DEF-ACT-0012)
evidence:
  - provenance: observed
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js
    note: >-
      The executable file is inspected at the pinned revision; duration is an
      unmeasured planning estimate.
  - provenance: documented
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#suite
      header
    note: >-
      Real: PostgreSQL, the migrations' keys, triggers and policies, the
      persistence services, the schedules library, the execution
  - provenance: documented
    source: >-
      services-accounting:modules/batches/tests/integration/services/persistence/batches.integration.spec.js#suite
      header
    note: >-
      context and its transactions under `rhythm_accounting_app`. Doubled:
      nothing. Never doubled: the statements, the rules or
unbound_scope: null
---

# Batch integration batches

## Verification Boundary

This suite exercises the imported batch services or storage against the prepared local database. It does not imply that a deployed workflow is contacted.

## What This Suite Proves

Creation, date changes, unit naming, version conflicts, locks and named lifecycle actions are checked together with scheduled-close and deletion effects. The assertion anchors identify the supported portions of the bound scenarios.

## What It Does Not Prove

Local assertions do not establish deployment configuration, remote delivery guarantees, or unasserted lifecycle and concurrency paths.

## Real Dependencies and Test Doubles

PostgreSQL and the exercised persistence or accounting functions are real. Controlled clocks, imported test fixtures and any suite-specific doubles delimit the asserted behavior.

## Must Not Be Doubled

The database constraints, transaction boundaries and exercised accounting functions must remain real when qualifying the asserted persistence or generation behavior.
