---
id: TST-COM-ORD-161
title: The landed cost shared over a receipt’s lines
kind: unit
product_area: commerce
module: orders
revision: 1
status: draft
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
repository: services-commerce
files:
  - modules/purchasing/tests/unit/cost/cost-rules.spec.js
implements:
  - ATS-COM-ORD-017-05
  - ATS-COM-ORD-018-04
  - ATS-COM-ORD-018-12
environment: mock
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 1
isolation: 'The suite owns its in-memory inputs, scripted responses and rendered component state.'
evidence:
  - provenance: test
    source: 'services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js'
    test_cases:
      - shares nothing when there is no landed cost or the allocation is none
      - 'shares by quantity to the minor unit, the last line taking the rounding remainder'
      - 'shares by value: a line worth three times another takes three times the landed cost'
      - gives the whole landed cost to the last line when the lines are worth nothing (by value at zero cost)
      - 'is the line’s cost plus its landed share per unit, to the nearest minor unit'
      - >-
        debits inventory and credits GRNI for a receipt, debits COGS and credits inventory for a handoff, the
        reverse for a restore
      - debits the adjustment account for a loss or a write-off and credits it for a gain
      - debits inventory for a cost that rose and credits it for one that fell
      - >-
        is the layers when the variable is absent, empty or says so, the fixture when it says fixture, and
        refused otherwise
      - is the ordered quantity less what was received and cancelled
      - makes one layer when the cost divides evenly
      - 'carries the remainder on a second layer one minor unit dearer, so Σ the layers is Σ the draws'
      - 'makes no layer for no units, and a zero-cost layer for units that cost nothing'
      - 'offers FIFO and LIFO, FIFO the default'
      - 'draws oldest first under FIFO: received_at, then id, ascending'
      - 'draws newest first under LIFO: received_at, then id, descending'
      - 'maps the method and the version read, the business unit the path’s'
      - 'accepts the record a read answered sent back whole, dropping what the server keeps'
      - 'refuses a method that is neither FIFO nor LIFO, by the ObjectInvalid refusal'
      - 'refuses a write without the version read, by the ObjectInvalid refusal'
      - 'refuses a body naming another business unit than the path’s, by the InvalidRequest refusal'
      - 'refuses a body naming another tenant than the path’s, by the InvalidRequest refusal'
scenario_coverage:
  - scenario: ATS-COM-ORD-017-05
    test_cases:
      - is the ordered quantity less what was received and cancelled
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-018-04
    test_cases:
      - 'shares by quantity to the minor unit, the last line taking the rounding remainder'
      - 'shares by value: a line worth three times another takes three times the landed cost'
      - 'is the line’s cost plus its landed share per unit, to the nearest minor unit'
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
  - scenario: ATS-COM-ORD-018-12
    test_cases:
      - >-
        debits inventory and credits GRNI for a receipt, debits COGS and credits inventory for a handoff, the
        reverse for a restore
      - debits the adjustment account for a loss or a write-off and credits it for a gain
    scope: >-
      The cited cases exercise the scenario’s listed fixture outcomes; this register makes no verified
      conformance claim.
dependency_evidence:
  provenance: test
  source: 'services-commerce:modules/purchasing/tests/unit/cost/cost-rules.spec.js'
  declared_by_test: 'the functions. Doubled: nothing.'
---

# The landed cost shared over a receipt’s lines

## Verification Boundary

The unit suite checks the named contract or helper with controlled inputs.

## What This Suite Proves

The registered cases check the landed cost shared over a receipt’s lines with their fixture records and assertions. Scenario bindings name only the examples those cases exercise.

## What It Does Not Prove

A registered file supplies no run result or verified conformance by itself. Local fixtures do not establish deployed cross-service behavior or complete browser journeys.

## Real Dependencies and Test Doubles

Inputs and external responses are controlled in process; this suite establishes no deployed service behavior.

## Must Not Be Doubled

The named contract validation or component behavior under assertion must use its actual implementation.
