fix(jd-publish): 重试复位后带回直推载荷+克隆缺源身份文案分档——35147 重试实录三件
This commit is contained in:
@@ -306,3 +306,41 @@ it('源商品失败提示换店或重选,并保留普通原位重试', async (
|
||||
expect(api.retry).toHaveBeenCalledExactlyOnceWith(88)
|
||||
expect(api.retryBrand).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('普通重试把响应带回的直推载荷推回本机队列(复位是 PENDING,兜底拉取默认关闭)', async () => {
|
||||
api.history.mockResolvedValue({ items: [row('FAILED', 3, loginError)] })
|
||||
api.progress.mockResolvedValue(batch(row('FAILED', 3, loginError)))
|
||||
const retryPayload = { ...queuePayload, data: { taskId: 88, resumeAttempt: 4, serverOnly: true } }
|
||||
api.retry.mockResolvedValue({ queuePayload: retryPayload })
|
||||
const page = await mountPage()
|
||||
await page.get('.history-btn').trigger('click')
|
||||
await page.get('.btn-retry').trigger('click')
|
||||
await flushPromises()
|
||||
expect(api.retry).toHaveBeenCalledExactlyOnceWith(88)
|
||||
expect(api.enqueue).toHaveBeenCalledExactlyOnceWith(retryPayload)
|
||||
expect(api.activate).not.toHaveBeenCalled()
|
||||
expect(api.retryBrand).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('服务端不带直推载荷时重试维持兜底口径,不推空载荷', async () => {
|
||||
api.history.mockResolvedValue({ items: [row('FAILED', 0, sourceError)] })
|
||||
const page = await mountPage()
|
||||
await page.get('.history-btn').trigger('click')
|
||||
await page.get('.btn-retry').trigger('click')
|
||||
await flushPromises()
|
||||
expect(api.retry).toHaveBeenCalledExactlyOnceWith(88)
|
||||
expect(api.enqueue).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('克隆身份缺失(上架中源商品)提示引导改用非在售商品,不再误导换店', async () => {
|
||||
const cloneIdentityError = '本店源商品校验失败:京麦克隆响应未携带源商品身份(productId=0)'
|
||||
api.history.mockResolvedValue({ items: [row('FAILED', 0, cloneIdentityError)] })
|
||||
const page = await mountPage()
|
||||
await page.get('.history-btn').trigger('click')
|
||||
expect(page.text()).toContain('非在售商品')
|
||||
expect(page.text()).not.toContain('正确店铺')
|
||||
expect(page.text()).not.toContain('JD_SOURCE_NOT_FOUND')
|
||||
expect(api.alert).toHaveBeenCalledOnce()
|
||||
expect(api.alert.mock.calls[0].join(' ')).toContain('「上架中」商品如此')
|
||||
expect(page.get('.btn-retry').text()).toBe('重试')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user