- 手动匹配不再指派供货打手:停在待加好友,清空截止时间与超时分钟 - 物品名模板去掉「0 璀璨」残留;寄卖单号无提报号时回退库存编号 - 状态列按寄卖库存显示内部匹配,打手列保留供货打手标签 - 超时配置增加启用开关,默认关闭(不限时) - 补充前后端回归测试
83 lines
3.1 KiB
TypeScript
83 lines
3.1 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import { fileURLToPath } from 'node:url'
|
|
import test from 'node:test'
|
|
|
|
function readPanel(name: string) {
|
|
return readFileSync(
|
|
fileURLToPath(new URL(`../src/pages/admin/panels/${name}`, import.meta.url)),
|
|
'utf8',
|
|
)
|
|
}
|
|
|
|
test('提报审核:规格按寄卖模板渲染,有模板时不再写死旧字段', () => {
|
|
const page = readPanel('ConsignmentSubmissionsPanel.tsx')
|
|
|
|
assert.ok(
|
|
page.includes('resolveConsignmentSpecDisplayItems(record.specs, record.specValues)'),
|
|
'提报列表必须按模板字段渲染规格',
|
|
)
|
|
assert.ok(
|
|
page.includes('resolveConsignmentSpecText(viewingSubmission)'),
|
|
'提报详情必须使用模板规格文本',
|
|
)
|
|
assert.ok(
|
|
page.includes('{approveModalItem?.specs?.length ? null : ('),
|
|
'有模板规格时审核弹窗必须隐藏系统/区服/系列/钻级/璀璨旧字段',
|
|
)
|
|
assert.ok(
|
|
page.includes('const hasDynamicSpecs = Boolean(approveModalItem.specs?.length)'),
|
|
'提交前必须判断该分类是否有模板规格',
|
|
)
|
|
assert.ok(page.includes('...(hasDynamicSpecs'), '有模板规格时不得再提交旧规格字段')
|
|
assert.ok(page.includes('规格(按寄卖分类模板)'), '审核弹窗需要标明规格来自寄卖模板')
|
|
assert.ok(page.includes('请填写「'), '动态必填字段必须在表单层校验')
|
|
})
|
|
|
|
test('寄售仓库:列表/详情按模板渲染,编辑不再写死旧字段', () => {
|
|
const page = readPanel('ConsignmentInventoryPanel.tsx')
|
|
|
|
assert.ok(!page.includes("title: '和平精英规格'"), '仓库列表列名不得写死和平精英')
|
|
assert.ok(page.includes("title: '寄卖规格'"), '仓库列表列名应为通用「寄卖规格」')
|
|
assert.ok(
|
|
page.includes('resolveConsignmentSpecDisplayItems(record.specs, record.specValues)'),
|
|
'仓库列表必须按模板字段渲染规格',
|
|
)
|
|
assert.ok(
|
|
page.includes('resolveConsignmentSpecText(viewingItem)'),
|
|
'仓库详情必须使用模板规格文本',
|
|
)
|
|
assert.ok(
|
|
page.includes('{editingItem?.specs?.length ? null : ('),
|
|
'有模板规格时编辑弹窗必须隐藏旧规格字段',
|
|
)
|
|
assert.ok(
|
|
page.includes('const hasDynamicSpecs = Boolean(editingItem.specs?.length)'),
|
|
'保存前必须判断该分类是否有模板规格',
|
|
)
|
|
assert.ok(page.includes('...(hasDynamicSpecs'), '有模板规格时不得再提交旧规格字段')
|
|
assert.ok(page.includes('请填写「'), '动态必填字段必须在表单层校验')
|
|
})
|
|
|
|
test('物品详情的打手提报时间取来源提报创建时间', () => {
|
|
const inventoryPage = readPanel('ConsignmentInventoryPanel.tsx')
|
|
assert.ok(
|
|
inventoryPage.includes('viewingItem.sourceSubmissionCreatedAt || viewingItem.createdAt'),
|
|
'打手提报时间必须优先取来源提报创建时间',
|
|
)
|
|
|
|
const repo = readFileSync(
|
|
fileURLToPath(
|
|
new URL(
|
|
'../../backend/src/repositories/worker-platform/consignment-repo.ts',
|
|
import.meta.url,
|
|
),
|
|
),
|
|
'utf8',
|
|
)
|
|
assert.ok(
|
|
repo.includes('cs.created_at AS source_submission_created_at'),
|
|
'库存查询必须带来源提报创建时间',
|
|
)
|
|
})
|