Files
order_site/apps/frontend/tests/cost-center-channel-projection-ui.test.ts
T

42 lines
1.5 KiB
TypeScript

import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import test from 'node:test'
test('标准商品列表按当前渠道筛选,并单独展示来源、主渠道和兜底渠道', async () => {
const source = await readFile(
new URL('../src/pages/admin/cost-center/ProductCatalogPanel.tsx', import.meta.url),
'utf8',
)
assert.ok(source.includes('channel: channelFilter'))
assert.ok(!source.includes('carrierType: productSourceFilter'))
assert.ok(source.includes("title: '来源'"))
assert.ok(source.includes("title: '当前履约'"))
assert.ok(source.includes('row.activePrimaryChannel'))
assert.ok(source.includes('row.fallbackChannels'))
assert.ok(source.includes('未路由'))
})
test('渠道映射的统计、目录、队列和商品下拉都使用当前渠道', async () => {
const [panel, catalog, queue] = await Promise.all([
readFile(
new URL('../src/pages/admin/cost-center/ChannelMappingPanel.tsx', import.meta.url),
'utf8',
),
readFile(
new URL('../src/pages/admin/cost-center/ChannelMappingCatalog.tsx', import.meta.url),
'utf8',
),
readFile(
new URL('../src/pages/admin/cost-center/ChannelMappingQueue.tsx', import.meta.url),
'utf8',
),
])
assert.ok(panel.includes('channel: channelFilter'))
assert.ok(panel.includes('item.activePrimaryChannel === channelFilter'))
assert.ok(!panel.includes('carrierType: productSourceFilter'))
assert.ok(catalog.includes('channelLabel'))
assert.ok(queue.includes('channelLabel'))
})