chore(test): 清理旧迁移测试并统一前端格式

This commit is contained in:
yml2213
2026-11-07 17:52:15 +08:00
parent 8ef8c61862
commit 313e619744
4 changed files with 24 additions and 53 deletions
@@ -6,7 +6,9 @@ import test from 'node:test'
test('寄售仓库必须提供通过审核入库时间范围筛选,并透传到库存查询', () => {
// Windows 检出为 CRLF,多行断言里的 \n 会匹配失败,先统一换行
const source = readFileSync(
fileURLToPath(new URL('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx', import.meta.url)),
fileURLToPath(
new URL('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx', import.meta.url),
),
'utf8',
).replace(/\r\n/g, '\n')
@@ -25,7 +25,9 @@ function assertTopLevelMount(filePath: string, componentName: string) {
test('库存面板:手动匹配订单弹窗挂在顶层(按钮点了必须能弹出来)', () => {
assertTopLevelMount(
fileURLToPath(new URL('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx', import.meta.url)),
fileURLToPath(
new URL('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx', import.meta.url),
),
'ConsignmentManualMatchModal',
)
})
@@ -39,7 +41,9 @@ test('订单面板:手动指定现货弹窗同样挂在顶层', () => {
test('按钮点击要真的把状态设上,弹窗的 open 由该状态驱动', () => {
const source = readFileSync(
fileURLToPath(new URL('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx', import.meta.url)),
fileURLToPath(
new URL('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx', import.meta.url),
),
'utf8',
)
assert.ok(source.includes('setManualMatchItem(record)'), '行内按钮必须设置待匹配的现货')
@@ -48,7 +52,9 @@ test('按钮点击要真的把状态设上,弹窗的 open 由该状态驱动',
test('手动匹配入口必须按 consignment.fulfill 门控(提交的是履约动作,不能只挂 manage)', () => {
const inventoryPanel = readFileSync(
fileURLToPath(new URL('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx', import.meta.url)),
fileURLToPath(
new URL('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx', import.meta.url),
),
'utf8',
)
// 库存面板:手动匹配订单按钮要与编辑/作废拆开 —— 前者 fulfill(提交打到
@@ -81,7 +87,9 @@ test('手动匹配入口必须按 consignment.fulfill 门控(提交的是履
test('手动匹配弹窗:数据过期的 409 要清选择并刷新,走内部现货直接履约', () => {
const source = readFileSync(
fileURLToPath(new URL('../src/components/admin/ConsignmentManualMatchModal.tsx', import.meta.url)),
fileURLToPath(
new URL('../src/components/admin/ConsignmentManualMatchModal.tsx', import.meta.url),
),
'utf8',
)
// 并发占用/规格在打开弹窗后被改 → 清空选择并重新拉列表,不能让运营循环撞同一个错
@@ -120,7 +128,9 @@ test('发布拦截弹窗:只走内部现货履约,文案停在待加好友
test('寄售仓库库存面板:必须包含「通过审核入库时间」列,且详情弹窗正确展示时间', () => {
const source = readFileSync(
fileURLToPath(new URL('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx', import.meta.url)),
fileURLToPath(
new URL('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx', import.meta.url),
),
'utf8',
)
assert.ok(source.includes("title: '通过审核入库时间'"), '库存表格必须有「通过审核入库时间」列')
@@ -137,7 +147,9 @@ test('寄售仓库库存面板:必须包含「通过审核入库时间」列
test('手动匹配弹窗:候选订单必须展示创建时间,现货展示审核入库时间', () => {
const source = readFileSync(
fileURLToPath(new URL('../src/components/admin/ConsignmentManualMatchModal.tsx', import.meta.url)),
fileURLToPath(
new URL('../src/components/admin/ConsignmentManualMatchModal.tsx', import.meta.url),
),
'utf8',
)
assert.ok(
@@ -5,7 +5,9 @@ import test from 'node:test'
test('自动核销最近任务展示并搜索核销码', () => {
const page = readFileSync(
fileURLToPath(new URL('../src/pages/admin/panels/VoucherConsumePolicyPanel.tsx', import.meta.url)),
fileURLToPath(
new URL('../src/pages/admin/panels/VoucherConsumePolicyPanel.tsx', import.meta.url),
),
'utf8',
)
const service = readFileSync(