refactor(cost-center): 统一人工标准商品与成本配置
This commit is contained in:
@@ -90,15 +90,20 @@ test('人工确认必须单事务:扣款与快照同事务,且使用 with-cl
|
||||
})
|
||||
|
||||
test('人工确认前必须自动匹配履约配置,配置保存/定时任务也要回填', async () => {
|
||||
const [manualSource, configSource, jobSource, migrationSource] = await Promise.all([
|
||||
readFile(new URL('./manual-fulfillment-service.ts', import.meta.url), 'utf8'),
|
||||
readFile(
|
||||
new URL('../cost-center/manual-fulfillment-config-service.ts', import.meta.url),
|
||||
'utf8',
|
||||
),
|
||||
readFile(new URL('../scheduler/finance-pipeline-jobs.ts', import.meta.url), 'utf8'),
|
||||
readFile(new URL('../../db/migrations/106_manual_sku_key.sql', import.meta.url), 'utf8'),
|
||||
])
|
||||
const [manualSource, configSource, jobSource, migrationSource, reconcileMigration] =
|
||||
await Promise.all([
|
||||
readFile(new URL('./manual-fulfillment-service.ts', import.meta.url), 'utf8'),
|
||||
readFile(
|
||||
new URL('../cost-center/manual-fulfillment-config-service.ts', import.meta.url),
|
||||
'utf8',
|
||||
),
|
||||
readFile(new URL('../scheduler/finance-pipeline-jobs.ts', import.meta.url), 'utf8'),
|
||||
readFile(new URL('../../db/migrations/106_manual_sku_key.sql', import.meta.url), 'utf8'),
|
||||
readFile(
|
||||
new URL('../../db/migrations/135_reconcile_manual_standard_products.sql', import.meta.url),
|
||||
'utf8',
|
||||
),
|
||||
])
|
||||
assert.ok(
|
||||
manualSource.includes('matchManualFulfillmentConfigWithClient(client, orderItemId, now)'),
|
||||
'确认时必须按 SKU 自动挂渠道',
|
||||
@@ -137,6 +142,18 @@ test('人工确认前必须自动匹配履约配置,配置保存/定时任务
|
||||
migrationSource.includes('sku_name'),
|
||||
'生成列必须保留 sku_code / sku_name 兜底',
|
||||
)
|
||||
const listStart = configSource.indexOf('export async function listManualSkus')
|
||||
const listEnd = configSource.indexOf('export async function getManualSkuOverview')
|
||||
const listBody = configSource.slice(listStart, listEnd)
|
||||
assert.ok(
|
||||
listBody.includes('FROM product_catalog p') && listBody.includes('productSourceFilterSql'),
|
||||
'人工成本配置必须以 man: 标准商品为唯一清单来源',
|
||||
)
|
||||
assert.ok(
|
||||
reconcileMigration.includes('tmp_manual_product_merge') &&
|
||||
reconcileMigration.includes("status = 'archived'"),
|
||||
'存量重复人工 SKU 必须合并到同一标准商品并归档重复项',
|
||||
)
|
||||
})
|
||||
|
||||
test('人工成本缺失由管道按配置与快照生成并收口', async () => {
|
||||
|
||||
Reference in New Issue
Block a user