优化
This commit is contained in:
@@ -312,13 +312,13 @@ describe('GlobalSmartLoadingView', () => {
|
||||
const wrapper = mount(GlobalSmartLoadingView, { global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
vi.mocked(getSmartLoadingPlanByBooking).mockResolvedValue({ ...plan, version: 3 })
|
||||
vi.mocked(recommendSmartLoading).mockRejectedValue(new AxiosError(
|
||||
vi.mocked(recommendSmartLoading).mockRejectedValueOnce(new AxiosError(
|
||||
'conflict',
|
||||
'ERR_BAD_REQUEST',
|
||||
undefined,
|
||||
undefined,
|
||||
{ data: { code: 'A0409', message: '数据已被修改', requestId: 'request-1', traceId: 'trace-1' }, status: 200, statusText: 'OK', headers: {}, config: {} as never },
|
||||
))
|
||||
)).mockResolvedValueOnce({ ...plan, version: 4 })
|
||||
|
||||
const button = wrapper.findAll('button').find((item) => item.text().includes('智能推荐'))
|
||||
expect(button).toBeDefined()
|
||||
@@ -326,8 +326,9 @@ describe('GlobalSmartLoadingView', () => {
|
||||
await flushPromises()
|
||||
|
||||
expect(recommendSmartLoading).toHaveBeenCalledWith(plan.id, 2)
|
||||
expect(getSmartLoadingPlanByBooking).toHaveBeenCalledTimes(2)
|
||||
expect(warningMessage).toHaveBeenCalledWith('计划或 PDA 明细已变化,已刷新最新版本并保留筛选条件,请重新操作')
|
||||
expect(recommendSmartLoading).toHaveBeenCalledWith(plan.id, 3)
|
||||
expect(getSmartLoadingPlanByBooking).toHaveBeenCalledTimes(3)
|
||||
expect(warningMessage).not.toHaveBeenCalled()
|
||||
expect(wrapper.text()).not.toContain('装柜操作失败')
|
||||
expect(wrapper.text()).not.toContain('request-1')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user