补全历史履约通道优先级

This commit is contained in:
yml2213
2026-08-11 11:00:11 +08:00
parent c391122c67
commit 3d747aa5aa
2 changed files with 20 additions and 0 deletions
@@ -6,6 +6,18 @@ import {
resolveFulfillmentRoute, resolveFulfillmentRoute,
} from './routing-config-service.js' } from './routing-config-service.js'
test('normalizeFulfillmentRoutingConfig adds channels missing from historical priority configs', () => {
const config = normalizeFulfillmentRoutingConfig({
defaultExecutorPriority: ['kuaishou_ct_assisted', 'kuaishou_feifei'],
})
assert.deepEqual(config.defaultExecutorPriority, [
'kuaishou_ct_assisted',
'kuaishou_feifei',
'affiliate_dash',
])
})
test('resolveFulfillmentRoute 总开关关闭后不再回退默认配置,返回未选中', () => { test('resolveFulfillmentRoute 总开关关闭后不再回退默认配置,返回未选中', () => {
const result = resolveFulfillmentRoute({ const result = resolveFulfillmentRoute({
productName: '测试商品', productName: '测试商品',
@@ -440,6 +440,14 @@ function normalizeExecutorPriority(value: unknown) {
items.push(executorKey) items.push(executorKey)
} }
// 历史配置不会自动拥有后来新增的履约通道;补全默认通道,开关仍由 executors 控制。
for (const executorKey of DEFAULT_EXECUTOR_PRIORITY) {
if (!seen.has(executorKey)) {
seen.add(executorKey)
items.push(executorKey)
}
}
return items return items
} }