---
id: TST-ACC-TRX-150
title: Tax calculation suite
kind: unit
product_area: accounting
module: transactions
revision: 1
status: draft
source_sha:
  services-accounting: f47cb263875bbc0c5640fba7dae6785ec32695f8
repository: services-accounting
files:
  - modules/transactions/tests/unit/rules/tax-calculation.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: 1
isolation: In-memory fixtures and test-controlled collaborators.
provenance: test
source: >-
  services-accounting:modules/transactions/tests/unit/rules/tax-calculation.spec.js
evidence:
  - provenance: test
    source: >-
      services-accounting:modules/transactions/tests/unit/rules/tax-calculation.spec.js
    assertion_titles:
      - >-
        the tax address (Andrew, 2026-10-18: a shipping line at the ship-to,
        every other line at the bill-to; 1.0: the billing address, else the
        shipping)
      - >-
        taxes a line that does not ship at the bill-to when the caller has one,
        else at the ship-to
      - >-
        taxes a line that ships at the ship-to when the caller has one, else at
        the bill-to
      - taxes at nothing when neither is given
      - 'zone matching (1.0: Determine Shipping Zone)'
      - postal code ranges
      - should match the beginning of the range
      - should match the end of the range
      - should match the middle of the range
      - should NOT match the outside of the range
      - >-
        compares the postal code without its spaces or case, as the ranges are
        stored
      - states
      - should match if the state matches
      - should NOT match if the state does not match
      - matches the state whatever its case
      - countries
      - should match if the country matches
      - should match if the country is null
      - should match if the country is blank
      - should NOT match if the country does not match
      - the zone chosen
      - takes the first active zone in the order given that matches
      - skips an inactive zone
      - >-
        falls back to the rest of the world when no other zone matches, wherever
        it is in the list
      - >-
        matches no zone when none applies and there is no rest of the world, or
        there is no address
      - 'Tax Calculation Logic (1.0, carried)'
      - should create a tax component with the correct
      - 'jurisdiction, class, rate, amount and account, one per rate per line'
      - 'line reference, so the caller keys the answer back'
      - zone and rate ids on every component
      - 'in a simple scenario, taxes should properly generate'
      - state taxes for the hoodie and the vest
      - federal taxes for the hoodie and the vest
      - total taxes on the hoodie line item and on the vest line item
      - 'when discounts are applied to line items, taxes should properly generate'
      - state taxes for the hoodie
      - federal taxes for the hoodie
      - total taxes on the hoodie line item
      - 'when a tax rate is disabled, logic should properly generate'
      - the correct number of components
      - the federal rate for the hoodie and for the vest
      - >-
        when a product is in a different tax class, logic should properly
        generate
      - the state rate for the hoodie with the new tax class
      - the federal rate for the hoodie with the new tax class
      - what 1.0 skipped
      - >-
        taxes nothing of a line with no tax class, or whose class the rate does
        not name (1.0: "No tax class found", skipped)
      - 'makes no component for a zero amount (1.0: "don\'
      - >-
        rounds each rate on its own, half away from zero, to a whole minor unit
        (1.0: round(total * rate / 100, 2))
      - >-
        names no G/L account on a component: the tax payable account is the
        posting’s to resolve (Andrew, 2026-10-18)
      - 'calculateTax, the whole'
      - 'answers the zone, the address used, every line and the total'
      - >-
        taxes a shipping line at the ship-to address and its zone, the other
        lines at the bill-to, each line saying which
      - >-
        warns once per kind of miss across the lines: a line whose address no
        zone matches, a shipping line falling back to it
      - >-
        answers every line zero with no components, and the warning, when there
        is no address (1.0: "No billing address.... not charging taxes")
      - >-
        answers every line zero, and the warning, when no zone matches (1.0: "if
        we\
      - >-
        answers every line zero with exempt true, and no warning, for an
        exemption
      - >-
        refusesForNoTaxAddress (D-T4: a document with no address to tax at is
        refused)
      - 'refuses a taxed line with neither address, under an active zone'
      - >-
        does not refuse a line with no tax class, a tenant with no zone, an
        exempt bill-to, or an address to tax at
    imports:
      - 'const { expect } = require(''chai'');'
      - '} = require(''../../../services/tax/tax-calculation'');'
    test_double_declarations: []
---

# Tax calculation suite

## Verification Boundary

The suite exercises financial calculations and input contracts in an isolated test process. 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

Pure calculations and doubled collaborators do not establish database persistence, route authorization or deployed behavior. An unbound feature chain remains proposed, and this registration carries no execution result.

## Real Dependencies and Test Doubles

The imported calculation or contract runs with the fixtures and collaborators declared by the test. The evidence register retains those declarations so the boundaries can be inspected.

## Must Not Be Doubled

The calculation or contract being asserted must remain real; replacing it with a predetermined result removes this suite’s evidence.
