fix(consignment): 内部库存匹配仅允许待分配和待抢单

This commit is contained in:
2026-11-13 16:34:44 +08:00
parent d8793db593
commit 40fa9e2725
9 changed files with 163 additions and 41 deletions
@@ -114,15 +114,33 @@ test('整单覆盖:必须一条库存满足全部数量', () => {
assert.equal(enough.sufficient, true)
})
test('工单页:internal_matching 显示「手动匹配寄卖」入口', () => {
test('工单页:内部库存匹配只对待分配/待抢单显示,不再包含内部匹配中', () => {
const source = readFileSync(
fileURLToPath(new URL('../src/pages/admin/panels/WorkOrdersPanel.tsx', import.meta.url)),
'utf8',
)
assert.ok(source.includes('手动匹配寄卖'), '内部匹配中的按钮文案必须是手动匹配寄卖')
assert.ok(
source.includes("String(row.status || '') === 'internal_matching'"),
'按钮文案必须只在 internal_matching 下切换',
source.includes("['unassigned', 'open'].includes(String(row.status || ''))"),
'内部库存匹配入口必须只覆盖待分配/待抢单',
)
assert.ok(!source.includes("'internal_matching'"), '状态筛选与入口都不应再包含内部匹配中')
})
test('匹配弹窗:接口错误必须展示,不能伪装成没有库存', () => {
const source = readFileSync(
fileURLToPath(
new URL('../src/components/admin/ConsignmentWorkOrderMatchModal.tsx', import.meta.url),
),
'utf8',
)
assert.ok(source.includes('candidatesQuery.isError'), '必须处理候选查询错误')
assert.ok(source.includes('读取可匹配寄卖库存失败'), '必须展示错误标题')
assert.ok(source.includes('重试'), '必须提供重试入口')
assert.ok(
source.includes(
'!candidatesQuery.isLoading && !candidatesQuery.isError && options.length === 0',
),
'空状态必须排除错误场景',
)
})