feat(phase-4/5 用户端): 恢复巡店删除与指定删除ASIN两个功能页与全部表件
用户口径:这两个功能是随 fdaae3c5 连带删错(该退役的只有紫鸟新版/旧版选项控件),
本次按历史逐字找回并摘掉紫鸟引用。
- 页面:BrandDeleteBrandTab.vue(1740行) / BrandPatrolDeleteTab.vue(1370行) 从 fdaae3c5~1 找回,
两页各摘 5 处 ZiniaoVersionSetting/useZiniaoVersion 引用与 1 个 ziniao_version 载荷字段
(checkQueuePayload 只钉 taskId,摘掉不触闸;全树其余读点 0 处)
- 表件:router 两条路由、tool-catalog 18→20 工具与四条图标/详情、BrandTopBar 导航两条、
endpoints 两块(deleteBrand 10 键 / patrolDelete 16 键)、progress-light 10→12、
java-modules re-export、module-templates 联合、withdraw.ts 巡店段整文件找回(513 行,
含两个 ProductRisk*Vo import)
- 测试面:9 支退役时改过的用例从 fdaae3c5~1 逐字找回(含 modules-delete-brand.test.ts 167 行/11 例)
- 自证:npm test 854/854 绿(基线 840+找回 14 例)、vue-tsc --noEmit 与 vite build 通过
- 未触碰他人在飞件:BrandSimilarAsinTab.vue / task-status-text.ts / similar-asin-fake-completed.test.ts
注:恢复后的三支大文件将顶破 ops 侧 readability 棘轮,基线随本轮在 ops 仓重锚并登记。
This commit is contained in:
@@ -11,11 +11,9 @@ import {
|
||||
TOOL_MAP,
|
||||
} from '../src/pages/amazon/tool-catalog.ts'
|
||||
|
||||
test('工具目录:18 个工具 id 唯一且每个都有图标与渐变配色', () => {
|
||||
test('工具目录:20 个工具 id 唯一且每个都有图标与渐变配色', () => {
|
||||
const ids = TOOL_GROUPS.flatMap((g) => g.tools.map((t) => t.id))
|
||||
// 2026-10-15 旧版界面退役:删除品牌(delasin)与巡店删除(patrol)两条目随功能摘除,
|
||||
// 工具总数 20→18(前端8 + 运营8 + 后勤2)。
|
||||
assert.equal(ids.length, 18, '工具总数应为 18(前端8 + 运营8 + 后勤2)')
|
||||
assert.equal(ids.length, 20, '工具总数应为 20(前端8 + 运营10 + 后勤2)')
|
||||
assert.equal(new Set(ids).size, ids.length, '工具 id 不应重复')
|
||||
for (const id of ids) {
|
||||
assert.ok(TOOL_ICON_SHAPES[id], `图标形状缺失: ${id}`)
|
||||
|
||||
@@ -6,17 +6,16 @@ import { dirname, join } from 'node:path'
|
||||
|
||||
/**
|
||||
* 「行数据按需拉取」接线守卫(审查 F5 后续):
|
||||
* 品牌工具页用轻量端点的结果行版本跳过重型 batch;这里守住两件最容易写错的事
|
||||
* 5 个品牌工具页用轻量端点的结果行版本跳过重型 batch;这里守住两件最容易写错的事
|
||||
* ——①接线没被误删;②跳过分支的返回值必须符合调用方契约(曾经把 shopDataCrawl 写成裸 return,
|
||||
* 而调用方 waitForTerminal 把 falsy 当「任务已消失 → FAILED」,会误杀正在跑的任务)。
|
||||
*/
|
||||
const PAGES_DIR = join(dirname(fileURLToPath(import.meta.url)), '../src/pages/brand/components')
|
||||
|
||||
// 2026-10-15 旧版界面退役:原第 3 个页签 BrandPatrolDeleteTab.vue(巡店删除)随功能
|
||||
// 一并退役删除,接线名单 5→4;其余四页一字未动。
|
||||
const WIRED_PAGES = [
|
||||
'BrandQueryAsinTab.vue',
|
||||
'BrandWithdrawTab.vue',
|
||||
'BrandPatrolDeleteTab.vue',
|
||||
'BrandShopDataCrawlTab.vue',
|
||||
'BrandAppearancePatentTab.vue',
|
||||
]
|
||||
@@ -38,7 +37,7 @@ test('轻量请求失败必须回退为全量拉取(不得因此少拉任务
|
||||
// 多任务页:catch 里把 heavyIds 还原成全部任务
|
||||
// 回退必须写在 catch 体内:用 [^}] 锁住,否则窗口会跨过 catch 的右花括号,
|
||||
// 把后面正常分支的 return(如 { taskIds, force: true })当成回退,断言恒真。
|
||||
for (const page of ['BrandQueryAsinTab.vue', 'BrandWithdrawTab.vue']) {
|
||||
for (const page of ['BrandQueryAsinTab.vue', 'BrandWithdrawTab.vue', 'BrandPatrolDeleteTab.vue']) {
|
||||
assert.match(sourceOf(page), /catch\s*\{[^}]{0,200}?heavyIds = ids/, `${page} 缺少轻量失败回退`)
|
||||
}
|
||||
assert.match(sourceOf('BrandAppearancePatentTab.vue'),
|
||||
@@ -58,4 +57,8 @@ test('跳过分支的返回值符合调用方契约', () => {
|
||||
assert.match(shopDataCrawl, /selectTasksNeedingRows\([\s\S]{0,200}?return true/,
|
||||
'BrandShopDataCrawlTab 跳过分支必须 return true(false/undefined 会被当成任务已消失)')
|
||||
|
||||
const patrolDelete = sourceOf('BrandPatrolDeleteTab.vue')
|
||||
// waitForTaskTerminal: `missingTaskIds.includes(taskId)` —— 未消失时返回空数组
|
||||
assert.match(patrolDelete, /selectTasksNeedingRows\([\s\S]{0,300}?return \[\]/,
|
||||
'BrandPatrolDeleteTab 跳过分支必须返回空 missingTaskIds 数组')
|
||||
})
|
||||
|
||||
@@ -8,8 +8,10 @@ const MODULE_KEYS = [
|
||||
'split',
|
||||
'convert',
|
||||
'publish',
|
||||
'deleteBrand',
|
||||
'productRisk',
|
||||
'shopMatch',
|
||||
'patrolDelete',
|
||||
'queryAsin',
|
||||
'shopDataCrawl',
|
||||
'withdraw',
|
||||
@@ -78,6 +80,8 @@ test('test_progress_batch_paths_match_controllers', () => {
|
||||
'/api/appearance-patent/tasks/progress/batch',
|
||||
'/api/collect-data/tasks/progress/batch',
|
||||
'/api/publish/tasks/progress/batch',
|
||||
'/api/delete-brand/tasks/progress/batch',
|
||||
'/api/patrol-delete/tasks/progress/batch',
|
||||
'/api/price-track/tasks/progress/batch',
|
||||
'/api/product-risk-resolve/tasks/progress/batch',
|
||||
'/api/shop-match/tasks/progress/batch',
|
||||
@@ -144,6 +148,18 @@ test('test_endpoints_frozen_snapshot', () => {
|
||||
"history": "/api/publish/history",
|
||||
"taskDelete": "/api/publish/tasks/{taskId}"
|
||||
},
|
||||
"deleteBrand": {
|
||||
"run": "/api/delete-brand/run",
|
||||
"history": "/api/delete-brand/history",
|
||||
"historyDelete": "/api/delete-brand/history/{resultId}",
|
||||
"taskDetail": "/api/delete-brand/tasks/{taskId}",
|
||||
"taskDetails": "/api/delete-brand/tasks/batch",
|
||||
"taskDownload": "/api/delete-brand/tasks/{taskId}/download",
|
||||
"resultDownload": "/api/delete-brand/results/{resultId}/download",
|
||||
"resultSubmit": "/api/delete-brand/tasks/{taskId}/result",
|
||||
"progressBatch": "/api/delete-brand/tasks/progress/batch",
|
||||
"progressLight": "/api/delete-brand/tasks/progress/light"
|
||||
},
|
||||
"productRisk": {
|
||||
"candidates": "/api/product-risk-resolve/candidates",
|
||||
"candidateAdd": "/api/product-risk-resolve/candidates",
|
||||
@@ -180,6 +196,24 @@ test('test_endpoints_frozen_snapshot', () => {
|
||||
"skipAsins": "/api/shop-match/tasks/{taskId}/skip-asins/paginated",
|
||||
"resultDownload": "/api/shop-match/results/{resultId}/download"
|
||||
},
|
||||
"patrolDelete": {
|
||||
"candidates": "/api/patrol-delete/candidates",
|
||||
"candidateAdd": "/api/patrol-delete/candidates",
|
||||
"candidateDelete": "/api/patrol-delete/candidates/{id}",
|
||||
"conditions": "/api/patrol-delete/conditions",
|
||||
"conditionAdd": "/api/patrol-delete/conditions",
|
||||
"conditionDelete": "/api/patrol-delete/conditions/{id}",
|
||||
"matchShops": "/api/patrol-delete/match-shops",
|
||||
"dashboard": "/api/patrol-delete/dashboard",
|
||||
"history": "/api/patrol-delete/history",
|
||||
"historyDelete": "/api/patrol-delete/history/{resultId}",
|
||||
"progressBatch": "/api/patrol-delete/tasks/progress/batch",
|
||||
"progressLight": "/api/patrol-delete/tasks/progress/light",
|
||||
"taskCreate": "/api/patrol-delete/tasks",
|
||||
"taskDelete": "/api/patrol-delete/tasks/{taskId}",
|
||||
"taskResult": "/api/patrol-delete/tasks/{taskId}/result",
|
||||
"resultDownload": "/api/patrol-delete/results/{resultId}/download"
|
||||
},
|
||||
"queryAsin": {
|
||||
"candidates": "/api/query-asin/candidates",
|
||||
"candidateAdd": "/api/query-asin/candidates",
|
||||
|
||||
@@ -14,6 +14,7 @@ import { resolve, dirname } from 'node:path'
|
||||
*/
|
||||
const here = dirname(fileURLToPath(import.meta.url))
|
||||
const priceTrack = readFileSync(resolve(here, '../src/pages/brand/components/BrandPriceTrackTab.vue'), 'utf8')
|
||||
const deleteBrand = readFileSync(resolve(here, '../src/pages/brand/components/BrandDeleteBrandTab.vue'), 'utf8')
|
||||
|
||||
function bodyOf(source: string, startMarker: string, endMarker: string, label: string) {
|
||||
const start = source.indexOf(startMarker)
|
||||
@@ -57,10 +58,17 @@ test('price_track_still_compensates_hard_failures', () => {
|
||||
'三处收尾:数据闸 / 桥异常 / 拒绝且不可等待')
|
||||
})
|
||||
|
||||
|
||||
// 2026-10-15 旧版界面退役:原「两页都引分类器」的 BrandDeleteBrandTab.vue 随功能删除,
|
||||
// 只剩跟价这一页(钉形状不变)。
|
||||
test('price_track_tab_imports_the_classifier', () => {
|
||||
assert.match(priceTrack, /classifyQueueRejection/, 'BrandPriceTrackTab.vue 未引用分类器')
|
||||
assert.match(priceTrack, /from '@\/shared\/dispatch-guard'/, 'BrandPriceTrackTab.vue 未从 dispatch-guard 导入')
|
||||
test('delete_brand_tab_uses_the_shared_classifier', () => {
|
||||
// 旧写法 includes('当前店铺正在执行中') 匹配不到带店名的文案(客户端两个互斥出口都带名),
|
||||
// 自动续跑的"重试"闸因此从未生效过。
|
||||
assert.doesNotMatch(deleteBrand, /includes\('当前店铺正在执行中'\)/, '仍在用匹配不到的中文串判互斥')
|
||||
assert.doesNotMatch(deleteBrand, /function isQueueBusyError/, '旧判定函数应随之删除,别留死代码')
|
||||
assert.match(deleteBrand, /classifyQueueRejection\(pushResult\)/, '没有改用共享分类器')
|
||||
})
|
||||
|
||||
test('both_tabs_import_the_classifier', () => {
|
||||
for (const [name, src] of [['BrandPriceTrackTab.vue', priceTrack], ['BrandDeleteBrandTab.vue', deleteBrand]] as const) {
|
||||
assert.match(src, /classifyQueueRejection/, `${name} 未引用分类器`)
|
||||
assert.match(src, /from '@\/shared\/dispatch-guard'/, `${name} 未从 dispatch-guard 导入`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,17 +6,16 @@ import { resolve, dirname } from 'node:path'
|
||||
import { http } from '../src/shared/api/http.ts'
|
||||
import { http as httpAgain } from '../src/shared/api/http.ts'
|
||||
|
||||
// 2026-10-15 旧版界面退役:'delete-brand' 模块随删除品牌功能删除,名单同步摘除。
|
||||
const moduleFiles = [
|
||||
'dedupe', 'split', 'convert', 'publish', 'similar-asin', 'appearance-patent',
|
||||
'price-track', 'shop-match', 'query-asin', 'withdraw',
|
||||
'delete-brand', 'price-track', 'shop-match', 'query-asin', 'withdraw',
|
||||
'collect-data', 'image-video', 'brand', 'permission', 'digital-human',
|
||||
]
|
||||
|
||||
const functionNames = [
|
||||
'runDedupe', 'getSplitHistory', 'runConvert', 'parsePublish',
|
||||
'parseSimilarAsin', 'parseAppearancePatent',
|
||||
'listPriceTrackCandidates', 'listProductRiskCandidates',
|
||||
'runDeleteBrand', 'listPriceTrackCandidates', 'listProductRiskCandidates',
|
||||
'listShopMatchCandidates', 'listQueryAsinCandidates', 'listWithdrawCandidates',
|
||||
'listShopDataCrawlCandidates', 'parseCollectData', 'getImageVideoSecretStatus',
|
||||
'expandBrandFolderRecursive', 'getCurrentUserAppColumnKeys',
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { http } from '../src/shared/api/http.ts'
|
||||
import {
|
||||
runDeleteBrand,
|
||||
getDeleteBrandHistory,
|
||||
deleteDeleteBrandHistory,
|
||||
getDeleteBrandTaskDetail,
|
||||
getDeleteBrandTaskDetails,
|
||||
getDeleteBrandTaskDownloadUrl,
|
||||
getDeleteBrandResultDownloadUrl,
|
||||
submitDeleteBrandResult,
|
||||
getDeleteBrandTaskProgress,
|
||||
type DeleteBrandRunRequest,
|
||||
type DeleteBrandSubmitResultRequest,
|
||||
} from '../src/shared/api/types/modules/delete-brand.ts'
|
||||
|
||||
function setupWindow() {
|
||||
;(globalThis as Record<string, unknown>).window = {
|
||||
localStorage: { getItem: () => '42' },
|
||||
location: { origin: 'http://localhost' },
|
||||
}
|
||||
}
|
||||
|
||||
function mockRequest(
|
||||
t: Parameters<typeof test>[1] extends (t: infer T) => unknown ? T : never,
|
||||
impl: (config: { url?: string; method?: string; params?: Record<string, unknown>; data?: unknown; timeout?: number }) => Promise<unknown>,
|
||||
) {
|
||||
t.mock.method(http, 'request', impl as never)
|
||||
}
|
||||
|
||||
const okResponse = (data: unknown) => Promise.resolve({ data: { success: true, message: 'ok', data } })
|
||||
|
||||
const runRequest: Omit<DeleteBrandRunRequest, 'user_id'> = {
|
||||
files: [{ fileKey: 'k1' }],
|
||||
}
|
||||
|
||||
test('test_delete_brand_run_url_payload', async (t) => {
|
||||
setupWindow()
|
||||
let captured: { url?: string; method?: string; data?: unknown; timeout?: number } = {}
|
||||
mockRequest(t, (config) => {
|
||||
captured = config
|
||||
return okResponse({ total: 1, successCount: 0, failedCount: 1, items: [] })
|
||||
})
|
||||
await runDeleteBrand(runRequest)
|
||||
assert.equal(captured.url, '/newApi/api/delete-brand/run')
|
||||
assert.equal(captured.method, 'POST')
|
||||
assert.deepEqual(captured.data, { ...runRequest, user_id: 42 })
|
||||
assert.equal(captured.timeout, 180000)
|
||||
})
|
||||
|
||||
test('test_delete_brand_history', async (t) => {
|
||||
setupWindow()
|
||||
let captured: { url?: string; params?: Record<string, unknown> } = {}
|
||||
mockRequest(t, (config) => {
|
||||
captured = config
|
||||
return okResponse({ items: [] })
|
||||
})
|
||||
await getDeleteBrandHistory()
|
||||
assert.equal(captured.url, '/newApi/api/delete-brand/history')
|
||||
assert.deepEqual(captured.params, { user_id: 42 })
|
||||
})
|
||||
|
||||
test('test_delete_brand_delete_history', async (t) => {
|
||||
setupWindow()
|
||||
let captured: { url?: string; method?: string; params?: Record<string, unknown> } = {}
|
||||
mockRequest(t, (config) => {
|
||||
captured = config
|
||||
return okResponse(null)
|
||||
})
|
||||
await deleteDeleteBrandHistory(7)
|
||||
assert.equal(captured.url, '/newApi/api/delete-brand/history/7')
|
||||
assert.equal(captured.method, 'DELETE')
|
||||
assert.deepEqual(captured.params, { user_id: 42 })
|
||||
})
|
||||
|
||||
test('test_delete_brand_task_detail', async (t) => {
|
||||
setupWindow()
|
||||
let captured: { url?: string } = {}
|
||||
mockRequest(t, (config) => {
|
||||
captured = config
|
||||
return okResponse({ task: { id: 7 }, line_progress: { has_progress: true }, items: [] })
|
||||
})
|
||||
const result = await getDeleteBrandTaskDetail(7)
|
||||
assert.equal(captured.url, '/newApi/api/delete-brand/tasks/7')
|
||||
assert.equal(result.task.id, 7)
|
||||
assert.equal(result.line_progress.has_progress, true)
|
||||
})
|
||||
|
||||
test('test_delete_brand_task_details', async (t) => {
|
||||
setupWindow()
|
||||
let captured: { url?: string; method?: string; data?: unknown } = {}
|
||||
mockRequest(t, (config) => {
|
||||
captured = config
|
||||
return okResponse({ items: [], missingTaskIds: [] })
|
||||
})
|
||||
await getDeleteBrandTaskDetails([5, 3])
|
||||
assert.equal(captured.url, '/newApi/api/delete-brand/tasks/batch')
|
||||
assert.equal(captured.method, 'POST')
|
||||
assert.deepEqual(captured.data, { taskIds: [5, 3], userId: 42 })
|
||||
})
|
||||
|
||||
test('test_delete_brand_task_download_url', async (t) => {
|
||||
setupWindow()
|
||||
assert.equal(
|
||||
getDeleteBrandTaskDownloadUrl(7),
|
||||
'http://localhost/newApi/api/delete-brand/tasks/7/download?user_id=42',
|
||||
)
|
||||
})
|
||||
|
||||
test('test_delete_brand_result_download_url', async (t) => {
|
||||
setupWindow()
|
||||
assert.equal(
|
||||
getDeleteBrandResultDownloadUrl(9),
|
||||
'http://localhost/newApi/api/delete-brand/results/9/download?user_id=42',
|
||||
)
|
||||
})
|
||||
|
||||
test('test_delete_brand_submit_result_body', async (t) => {
|
||||
setupWindow()
|
||||
let captured: { url?: string; method?: string; data?: unknown } = {}
|
||||
mockRequest(t, (config) => {
|
||||
captured = config
|
||||
return okResponse(null)
|
||||
})
|
||||
const body: DeleteBrandSubmitResultRequest = {
|
||||
submissionId: 'sub-1',
|
||||
files: [{ sourceFilename: 'a.xlsx', countries: [] }],
|
||||
}
|
||||
await submitDeleteBrandResult(7, body)
|
||||
assert.equal(captured.url, '/newApi/api/delete-brand/tasks/7/result')
|
||||
assert.equal(captured.method, 'POST')
|
||||
assert.deepEqual(captured.data, body)
|
||||
})
|
||||
|
||||
test('test_delete_brand_progress_batch', async (t) => {
|
||||
setupWindow()
|
||||
let captured: { url?: string; method?: string; data?: unknown; timeout?: number } = {}
|
||||
mockRequest(t, (config) => {
|
||||
captured = config
|
||||
return okResponse({ items: [], missingTaskIds: [] })
|
||||
})
|
||||
const result = await getDeleteBrandTaskProgress([5, 3])
|
||||
assert.equal(captured.url, '/newApi/api/delete-brand/tasks/progress/batch')
|
||||
assert.equal(captured.method, 'POST')
|
||||
assert.deepEqual(captured.data, { taskIds: [3, 5], userId: 42 })
|
||||
assert.equal(captured.timeout, 10000)
|
||||
assert.deepEqual(result, { items: [], missingTaskIds: [] })
|
||||
})
|
||||
|
||||
test('test_delete_brand_export_compat', async (t) => {
|
||||
setupWindow()
|
||||
const fromJavaModules = await import('../src/shared/api/java-modules.ts')
|
||||
const fromDeleteBrand = await import('../src/shared/api/types/modules/delete-brand.ts')
|
||||
const names = [
|
||||
'runDeleteBrand', 'getDeleteBrandHistory', 'deleteDeleteBrandHistory',
|
||||
'getDeleteBrandTaskDetail', 'getDeleteBrandTaskDetails', 'getDeleteBrandTaskDownloadUrl',
|
||||
'getDeleteBrandResultDownloadUrl', 'submitDeleteBrandResult', 'getDeleteBrandTaskProgress',
|
||||
]
|
||||
for (const name of names) {
|
||||
assert.equal(fromJavaModules[name], fromDeleteBrand[name], `${name} 应为同一引用`)
|
||||
}
|
||||
const item = { id: 1, taskNo: 'T1', status: 'RUNNING' }
|
||||
assert.equal(item.taskNo, 'T1')
|
||||
const status: 'MATCHED' | 'PENDING' = 'MATCHED'
|
||||
assert.equal(status, 'MATCHED')
|
||||
})
|
||||
@@ -15,6 +15,21 @@ import {
|
||||
getWithdrawResultDownloadUrl,
|
||||
deleteWithdrawTask,
|
||||
deleteWithdrawHistory,
|
||||
listPatrolDeleteCandidates,
|
||||
addPatrolDeleteCandidate,
|
||||
deletePatrolDeleteCandidate,
|
||||
listPatrolDeleteConditions,
|
||||
addPatrolDeleteCondition,
|
||||
deletePatrolDeleteCondition,
|
||||
matchPatrolDeleteShops,
|
||||
getPatrolDeleteDashboard,
|
||||
getPatrolDeleteHistory,
|
||||
getPatrolDeleteTaskProgressBatch,
|
||||
createPatrolDeleteTask,
|
||||
submitPatrolDeleteTaskResult,
|
||||
getPatrolDeleteResultDownloadUrl,
|
||||
deletePatrolDeleteTask,
|
||||
deletePatrolDeleteHistory,
|
||||
} from '../src/shared/api/types/modules/withdraw.ts'
|
||||
|
||||
function setupWindow() {
|
||||
@@ -126,12 +141,91 @@ test('test_withdraw_match', async (t) => {
|
||||
assert.deepEqual(calls[0].data, { user_id: 42, shop_names: ['店铺A'] })
|
||||
})
|
||||
|
||||
test('test_patrol_delete_candidates_conditions', async (t) => {
|
||||
setupWindow()
|
||||
const calls: { url?: string; method?: string; params?: Record<string, unknown>; data?: unknown }[] = []
|
||||
mockRequest(t, (config) => {
|
||||
calls.push(config)
|
||||
return okResponse({ id: 1, shop_name: 's1' })
|
||||
})
|
||||
await listPatrolDeleteCandidates()
|
||||
await addPatrolDeleteCandidate('店铺A')
|
||||
await deletePatrolDeleteCandidate(3)
|
||||
await listPatrolDeleteConditions()
|
||||
await addPatrolDeleteCondition('条件X')
|
||||
await deletePatrolDeleteCondition(5)
|
||||
assert.equal(calls[0].url, '/newApi/api/patrol-delete/candidates')
|
||||
assert.deepEqual(calls[0].params, { user_id: 42 })
|
||||
assert.equal(calls[1].url, '/newApi/api/patrol-delete/candidates')
|
||||
assert.equal(calls[1].method, 'POST')
|
||||
assert.deepEqual(calls[1].data, { user_id: 42, shop_name: '店铺A' })
|
||||
assert.equal(calls[2].url, '/newApi/api/patrol-delete/candidates/3')
|
||||
assert.equal(calls[2].method, 'DELETE')
|
||||
assert.equal(calls[3].url, '/newApi/api/patrol-delete/conditions')
|
||||
assert.deepEqual(calls[3].params, { user_id: 42 })
|
||||
assert.equal(calls[4].url, '/newApi/api/patrol-delete/conditions')
|
||||
assert.equal(calls[4].method, 'POST')
|
||||
assert.deepEqual(calls[4].data, { user_id: 42, conditionText: '条件X' })
|
||||
assert.equal(calls[5].url, '/newApi/api/patrol-delete/conditions/5')
|
||||
assert.equal(calls[5].method, 'DELETE')
|
||||
})
|
||||
|
||||
test('test_patrol_delete_create_submit', async (t) => {
|
||||
setupWindow()
|
||||
const calls: { url?: string; method?: string; data?: unknown }[] = []
|
||||
mockRequest(t, (config) => {
|
||||
calls.push(config)
|
||||
return okResponse({ taskId: 1, items: [] })
|
||||
})
|
||||
const item = {
|
||||
shopName: '店铺A',
|
||||
matched: true,
|
||||
countrySections: [{ country: 'US', rows: [{ status: 'ok', quantity: '1', deleteQuantity: '0', processStatus: 'done' }] }],
|
||||
cartRatios: [{ country: 'US', ratio: '0.5' }],
|
||||
}
|
||||
await createPatrolDeleteTask([item])
|
||||
assert.equal(calls[0].url, '/newApi/api/patrol-delete/tasks')
|
||||
assert.equal(calls[0].method, 'POST')
|
||||
assert.deepEqual(calls[0].data, { user_id: 42, items: [item], delete_conditions: [] })
|
||||
const payload = { shops: [{ shopName: '店铺A', countrySections: item.countrySections, cartRatios: item.cartRatios, shopDone: true, chunkIndex: 0, chunkTotal: 1 }] }
|
||||
await submitPatrolDeleteTaskResult(7, payload)
|
||||
assert.equal(calls[1].url, '/newApi/api/patrol-delete/tasks/7/result')
|
||||
assert.deepEqual(calls[1].data, payload)
|
||||
})
|
||||
|
||||
test('test_patrol_delete_progress_dashboard_download', async (t) => {
|
||||
setupWindow()
|
||||
const calls: { url?: string; method?: string; data?: unknown; timeout?: number; params?: Record<string, unknown> }[] = []
|
||||
mockRequest(t, (config) => {
|
||||
calls.push(config)
|
||||
return okResponse({ items: [], missingTaskIds: [] })
|
||||
})
|
||||
await getPatrolDeleteTaskProgressBatch([5, 3])
|
||||
await getPatrolDeleteDashboard()
|
||||
await getPatrolDeleteHistory()
|
||||
await matchPatrolDeleteShops(['店铺A'])
|
||||
await deletePatrolDeleteTask(7)
|
||||
await deletePatrolDeleteHistory(9)
|
||||
assert.equal(calls[0].url, '/newApi/api/patrol-delete/tasks/progress/batch')
|
||||
assert.equal(calls[0].method, 'POST')
|
||||
assert.deepEqual(calls[0].data, { taskIds: [3, 5], userId: 42 })
|
||||
assert.equal(calls[0].timeout, 10000)
|
||||
assert.equal(calls[1].url, '/newApi/api/patrol-delete/dashboard')
|
||||
assert.deepEqual(calls[1].params, { user_id: 42 })
|
||||
assert.equal(calls[2].url, '/newApi/api/patrol-delete/history')
|
||||
assert.equal(calls[3].url, '/newApi/api/patrol-delete/match-shops')
|
||||
assert.deepEqual(calls[3].data, { user_id: 42, shop_names: ['店铺A'] })
|
||||
assert.equal(calls[4].url, '/newApi/api/patrol-delete/tasks/7')
|
||||
assert.equal(calls[4].method, 'DELETE')
|
||||
assert.equal(calls[5].url, '/newApi/api/patrol-delete/history/9')
|
||||
assert.equal(calls[5].method, 'DELETE')
|
||||
assert.equal(
|
||||
getPatrolDeleteResultDownloadUrl(7),
|
||||
'http://localhost/newApi/api/patrol-delete/results/7/download?user_id=42',
|
||||
)
|
||||
})
|
||||
|
||||
// 2026-10-15 旧版界面退役:巡店删除的 15 个 API 函数随功能从 withdraw.ts 切掉,
|
||||
// 本格只剩提款一组(原 test_withdraw_patrol_export_compat)。
|
||||
test('test_withdraw_export_compat', async (t) => {
|
||||
test('test_withdraw_patrol_export_compat', async (t) => {
|
||||
setupWindow()
|
||||
const fromJavaModules = await import('../src/shared/api/java-modules.ts')
|
||||
const fromWithdraw = await import('../src/shared/api/types/modules/withdraw.ts')
|
||||
@@ -141,6 +235,12 @@ test('test_withdraw_export_compat', async (t) => {
|
||||
'getWithdrawHistory', 'getWithdrawTaskProgressBatch', 'createWithdrawTask',
|
||||
'submitWithdrawTaskResult', 'getWithdrawResultDownloadUrl',
|
||||
'deleteWithdrawTask', 'deleteWithdrawHistory',
|
||||
'listPatrolDeleteCandidates', 'addPatrolDeleteCandidate', 'deletePatrolDeleteCandidate',
|
||||
'listPatrolDeleteConditions', 'addPatrolDeleteCondition', 'deletePatrolDeleteCondition',
|
||||
'matchPatrolDeleteShops', 'getPatrolDeleteDashboard', 'getPatrolDeleteHistory',
|
||||
'getPatrolDeleteTaskProgressBatch', 'createPatrolDeleteTask',
|
||||
'submitPatrolDeleteTaskResult', 'getPatrolDeleteResultDownloadUrl',
|
||||
'deletePatrolDeleteTask', 'deletePatrolDeleteHistory',
|
||||
]
|
||||
for (const name of names) {
|
||||
assert.equal(fromJavaModules[name], fromWithdraw[name], `${name} 应为同一引用`)
|
||||
|
||||
@@ -29,9 +29,8 @@ function mockRequest(
|
||||
|
||||
const okResponse = (data: unknown) => Promise.resolve({ data: { success: true, message: 'ok', data } })
|
||||
|
||||
// 2026-10-15 旧版界面退役:deleteBrand 与 patrolDelete 两模块随功能摘除(12→10)。
|
||||
const LIGHT_MODULES: ProgressLightModule[] = [
|
||||
'publish', 'productRisk', 'shopMatch',
|
||||
'publish', 'deleteBrand', 'productRisk', 'shopMatch', 'patrolDelete',
|
||||
'queryAsin', 'shopDataCrawl', 'withdraw', 'priceTrack', 'similarAsin',
|
||||
'appearancePatent', 'collectData',
|
||||
]
|
||||
@@ -154,11 +153,11 @@ test('test_light_snapshot', async (t) => {
|
||||
return okResponse({ items: [{ taskId: 1, status: 'RUNNING', fileReady: false }], missingTaskIds: [] })
|
||||
})
|
||||
await getModuleProgressLight('appearancePatent', [1], { force: true })
|
||||
await getModuleProgressLight('queryAsin', [2], { force: true })
|
||||
await getModuleProgressLight('deleteBrand', [2], { force: true })
|
||||
assert.equal(calls[0].url, '/newApi/api/appearance-patent/tasks/progress/light')
|
||||
assert.equal(calls[0].method, 'POST')
|
||||
assert.deepEqual(calls[0].data, { taskIds: [1] })
|
||||
assert.equal(calls[1].url, '/newApi/api/query-asin/tasks/progress/light')
|
||||
assert.equal(calls[1].url, '/newApi/api/delete-brand/tasks/progress/light')
|
||||
assert.deepEqual(calls[1].data, { taskIds: [2] })
|
||||
})
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { join } from 'node:path'
|
||||
* 任务卡片的「进度条接线」普查。
|
||||
*
|
||||
* 为什么要它:TaskItemView.progress 是可空字段,页面少写一行不会报错、不会红,
|
||||
* 界面上就是安静地没有进度条。每个任务页各写一处,漏哪一处全靠这条出声。
|
||||
* 界面上就是安静地没有进度条。11 个任务页各写一处,漏哪一处全靠这条出声。
|
||||
*
|
||||
* 分母不手抄:扫 src/pages/brand/components 下所有写了 `to*TaskView(...): TaskItemView`
|
||||
* 适配器的页面,清单由文件系统给出;再把总数硬钉住——新增页面没接进度、或有人把
|
||||
@@ -41,9 +41,7 @@ const pages = readdirSync(COMPONENTS).filter((name) => name.endsWith('.vue'))
|
||||
const seen = pages.flatMap((file) => adaptersOf(file).map((a) => ({ file, ...a })))
|
||||
|
||||
test('被扫描的任务卡适配器数量必须硬钉(少扫或多扫都说明扫描面变了)', () => {
|
||||
// 2026-10-15 旧版界面退役:BrandDeleteBrandTab 与 BrandPatrolDeleteTab 两页删除,
|
||||
// 适配器 16→14(少扫或多扫都说明扫描面变了)。
|
||||
assert.equal(seen.length, 14, `扫到 ${seen.length} 个 to*TaskView 适配器:${seen.map((s) => `${s.file}#${s.name}`).join(', ')}`)
|
||||
assert.equal(seen.length, 16, `扫到 ${seen.length} 个 to*TaskView 适配器:${seen.map((s) => `${s.file}#${s.name}`).join(', ')}`)
|
||||
})
|
||||
|
||||
test('每个任务卡适配器都必须给出进度读数,或明确给出 null', () => {
|
||||
|
||||
@@ -18,8 +18,8 @@ const root = resolve(here, '..')
|
||||
const rel = (p: string) => relative(root, p).split(sep).join('/')
|
||||
const SRC_FILES = listSourceFiles(resolve(root, 'src')).map(rel)
|
||||
|
||||
// 2026-10-15 旧版界面退役:BrandPatrolDeleteTab.vue(巡店删除)随功能删除,六页→五页。
|
||||
const TABS = [
|
||||
'BrandPatrolDeleteTab.vue',
|
||||
'BrandPriceTrackTab.vue',
|
||||
'BrandProductRiskTab.vue',
|
||||
'BrandQueryAsinTab.vue',
|
||||
@@ -40,6 +40,8 @@ const TABS = [
|
||||
const NARROW_LEDGER: Record<string, number> = {
|
||||
'src/pages/brand/components/BrandAppearancePatentTab.vue': 3,
|
||||
'src/pages/brand/components/BrandCollectDataTab.vue': 2,
|
||||
'src/pages/brand/components/BrandDeleteBrandTab.vue': 2,
|
||||
'src/pages/brand/components/BrandPatrolDeleteTab.vue': 1,
|
||||
'src/pages/brand/components/BrandPriceTrackTab.vue': 6,
|
||||
'src/pages/brand/components/BrandProductRiskTab.vue': 2,
|
||||
'src/pages/brand/components/BrandSimilarAsinTab.vue': 1,
|
||||
@@ -175,7 +177,7 @@ test('全 src 窄集合只许减:逐文件台账 + 分母自证', () => {
|
||||
}
|
||||
})
|
||||
|
||||
test('五个 Tab 的每条等待函数都真的走骨架(按 AST 认函数,不靠签名切字符串)', () => {
|
||||
test('六个 Tab 的每条等待函数都真的走骨架(按 AST 认函数,不靠签名切字符串)', () => {
|
||||
const offenders: string[] = []
|
||||
const seen: string[] = []
|
||||
for (const tab of TABS) {
|
||||
|
||||
Reference in New Issue
Block a user