test(fleet): resolve raw position ownership through its balance

This commit is contained in:
2026-10-03 07:44:17 +08:00
parent 18d22418ca
commit 2992871975
2 changed files with 5 additions and 1 deletions
@@ -152,6 +152,8 @@ function model(fault = '') {
assert.equal(scope.marker, context.marker); assert.equal(scope.warehouseId, options.warehouseId)
const facts = stock(transfers.find(row => row.customerId === scope.customerId))
const raw = { scope: { ...scope, coverage: 'CUSTOMER_WAREHOUSE_COMPLETE' }, balances: [facts.balance], positions: facts.positions, ledger: facts.ledger }
// The physical position table links to its inbound through balance_id; only the public joined DTO has inboundCode.
for (const position of raw.positions) delete position.inboundCode
if (fault === 'wrong raw scope') raw.scope.marker = 'OLD'
if (fault === 'wrong raw ledger position') raw.ledger[0].positionId = 'OTHER'
if (fault === 'wrong raw ledger balance') raw.ledger[0].balanceId = 'OTHER'