fix(consignment): 内部现货履约文案对齐待加好友,并移除已废弃的指派打手路径

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
yml2213
2026-09-21 12:04:30 +08:00
co-authored by Cursor
parent 29589bb9af
commit 577e0eec02
6 changed files with 83 additions and 69 deletions
@@ -100,3 +100,18 @@ test('手动匹配弹窗:数据过期的 409 要清选择并刷新,走内部
assert.ok(source.includes("from '@/utils/voucher-consume'"), '核销反馈必须用共享出口')
assert.ok(source.includes('keyword: keyword.trim() || undefined'), '库存侧关键字要透传后端')
})
test('发布拦截弹窗:只走内部现货履约,文案停在待加好友而不是冷静期', () => {
const source = readFileSync(
new URL('../src/pages/admin/panels/WorkOrdersPanel.tsx', import.meta.url).pathname,
'utf8',
)
assert.ok(source.includes('fulfillWorkOrderWithConsignment'), '拦截弹窗必须调用内部现货履约')
assert.ok(
!source.includes('assignWorkOrderWithConsignmentWorker'),
'拦截弹窗不得再调用旧的指派打手接口',
)
assert.ok(source.includes('进入待加好友'), '拦截弹窗必须写明工单进入待加好友')
assert.ok(!source.includes('自动进冷静期'), '拦截弹窗不得再写自动进冷静期')
assert.ok(!source.includes('进入赠送冷静期'), '成功提示不得再写成进入赠送冷静期')
})
@@ -1,7 +1,10 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { resolveConsignmentWorkerDisplay } from '../src/utils/consignment-display.ts'
import {
resolveConsignmentWorkerDisplay,
resolveConsignmentScreenshotUrls,
} from '../src/utils/consignment-display.ts'
test('普通工单无寄售信息时 resolveConsignmentWorkerDisplay 返回 null', () => {
const order = {
@@ -53,3 +56,18 @@ test('寄售工单无供货打手名时回退展示角色昵称与现货标签',
assert.equal(result.primaryName, '客服角色')
assert.equal(result.secondaryInfo, 'ID:1234551')
})
test('寄售截图兼容字符串 URL 与 UploadedFile 对象', () => {
assert.deepEqual(
resolveConsignmentScreenshotUrls([
'/api/v1/files/object?key=consignment_screenshot%2Fa.webp',
{ url: '/api/v1/files/object?key=consignment_screenshot%2Fb.webp' },
{ objectKey: 'x', url: '' },
12,
]),
[
'/api/v1/files/object?key=consignment_screenshot%2Fa.webp',
'/api/v1/files/object?key=consignment_screenshot%2Fb.webp',
],
)
})