docs+test: 补充成本缺失、退款期间与追溯限制说明

This commit is contained in:
yml2213
2026-11-01 15:21:55 +08:00
parent 20287916b1
commit a692723c73
8 changed files with 36 additions and 7 deletions
@@ -171,3 +171,26 @@ test('人工确认后必须立刻重算该业务日事实与总账', async () =>
assert.ok(source.includes('rebuildChannelSalesDailyFacts'), '必须重算渠道销售事实')
assert.ok(source.includes('syncFinanceLedgerFromFacts'), '必须同步总账')
})
test('成本缺失按渠道期望成本项判定,不能被通用费用掩盖', async () => {
const facts = await read(new URL('./sales-facts-channel-service.ts', import.meta.url))
assert.ok(facts.includes('channel_cost_code'))
assert.ok(facts.includes("'sys_affiliate_purchase'"))
assert.ok(facts.includes("cs.subject_type = 'manual_case'"))
})
test('退款所属期间关账时必须阻断', async () => {
const refund = await read(new URL('./order-refund-service.ts', import.meta.url))
assert.ok(refund.includes('assertRefundMonthOpen'))
assert.ok(refund.includes('退款所属期间'))
})
test('成本版本与基线导入不允许追溯历史', async () => {
const [definition, affiliate] = await Promise.all([
read(new URL('../cost-center/cost-definition-service.ts', import.meta.url)),
read(new URL('../cost-center/affiliate-product-service.ts', import.meta.url)),
])
assert.ok(definition.includes('cost_effective_from_in_past'))
assert.ok(affiliate.includes('cost_baseline_import_blocked'))
assert.ok(!affiliate.includes('shiftDate(today, -30)'))
})