fix(jd-collect): 进度条 0 行进行时文案——首批分片确认前不再挂「已采集 0 个商品」像卡死

This commit is contained in:
2026-11-21 03:02:44 +08:00
parent 9999bba223
commit 3a24674c9d
2 changed files with 35 additions and 1 deletions
@@ -246,6 +246,34 @@ describe('获取店铺数据:一键采集 + 任务面板', () => {
expect(w.find('.file-progress-bar').attributes('style')).toContain('width: 0%')
})
it('0 行且无分母时报进行时文案,不把「已采集 0 个商品」挂出来像卡死(35089 误删实录)', async () => {
// 首批分片被服务端收下前 itemsReceived 恒 0(页内详情采集 1-3 分钟);「已采集 0 个」
// 让用户以为失败点了删除——35088/35089/35090 三单采集成功但被这样清库(2026-11-21)。
api.fetchJdCollectTaskProgressBatch.mockResolvedValue(
batchOf(historyItem({ total: null, page: null, itemsReceived: 0, rowCount: 0 })),
)
const w = await mountPage()
await startCollect(w)
await flushPromises()
const meta = w.find('.file-progress-meta')
expect(meta.exists()).toBe(true)
expect(meta.text()).toContain('正在采集,首批数据确认后开始计数…')
expect(meta.text()).not.toContain('已采集 0 个商品')
})
it('0 行但有分母时报「已采 0/N(正在采集中…)」而不是纯 0/N', async () => {
api.fetchJdCollectTaskProgressBatch.mockResolvedValue(
batchOf(historyItem({ total: 100, page: 1, itemsReceived: 0, rowCount: 0 })),
)
const w = await mountPage()
await startCollect(w)
await flushPromises()
expect(w.find('.file-progress-meta').text()).toContain('已采 0/100 个商品(正在采集中…)')
expect(w.find('.file-progress-meta').text()).not.toContain('已采集 0 个商品')
})
it('分片被拒时进度行以落库 rowCount 为准(itemsReceived 低估不再与行数行自相矛盾)', async () => {
// 34959 实录(2026-11-19):8 行已落京东数据库、分片回传 500 ⇒ 服务端
// itemsReceived=0、rowCount=8,extraLines 显示「已采集 8 个商品」而进度行显示 0。