feat(cost-center): 第三方卡券渠道完整接入成本模型
- 商品来源筛选补 tpv: 前缀,卡券商品列表不再为空 - 成本模型新增 third_party_voucher_cost,覆盖预览/成本项/概览作用域 - 前后端成本模型枚举与下拉同步
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
|
||||
import { costModelAppliesTo } from './cost-center-mappers.js'
|
||||
import {
|
||||
normalizeMappingMatchType,
|
||||
normalizeProviderKey,
|
||||
@@ -8,6 +9,7 @@ import {
|
||||
} from './cost-center-shared.js'
|
||||
import { calculateCostTotal, validateCostVersionScope } from './cost-resolution-service.js'
|
||||
import { resolveMappingProductId } from './product-catalog-service.js'
|
||||
import { productSourceFilterSql } from './cost-center-mappers.js'
|
||||
import {
|
||||
buildTemplateMappingPlan,
|
||||
buildTemplateProductSku,
|
||||
@@ -289,3 +291,10 @@ test('接单模板改价 SQL 的参数必须显式指定 bigint', async () => {
|
||||
),
|
||||
)
|
||||
})
|
||||
|
||||
test('成本模型与商品来源必须覆盖第三方卡券渠道', () => {
|
||||
assert.equal(costModelAppliesTo('third_party_voucher_cost', 'third_party_voucher'), true)
|
||||
assert.equal(costModelAppliesTo('third_party_voucher_cost', 'manual'), false)
|
||||
assert.ok(productSourceFilterSql(1).includes("'third_party_voucher'"))
|
||||
assert.ok(productSourceFilterSql(1).includes("'tpv:%'"))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user