This commit is contained in:
2026-08-22 10:02:13 +08:00
parent 19683f8759
commit bff9ccbfb6
8 changed files with 63 additions and 18 deletions
@@ -75,10 +75,10 @@ describe('SmartLoadingWorkbenchView', () => {
vi.mocked(getSmartLoadingPlanByBooking)
.mockResolvedValueOnce(planResponse)
.mockResolvedValueOnce({ ...planResponse, 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({ ...planResponse, version: 4 })
const router = createRouter({ history: createMemoryHistory(), routes: [{ path: '/container-loading/:containerId/smart-loading', component: SmartLoadingWorkbenchView }] })
await router.push(`/container-loading/${container.id}/smart-loading`); await router.isReady()
const wrapper = mount(SmartLoadingWorkbenchView, { global: { plugins: [ElementPlus, router] } })
@@ -87,8 +87,9 @@ describe('SmartLoadingWorkbenchView', () => {
await wrapper.findAll('button').find((button) => button.text().includes('智能推荐'))!.trigger('click')
await flushPromises()
expect(getSmartLoadingPlanByBooking).toHaveBeenCalledTimes(2)
expect(wrapper.text()).toContain('已刷新最新版本')
expect(wrapper.text()).toContain('request-1')
expect(recommendSmartLoading).toHaveBeenCalledWith(planResponse.id, 2)
expect(recommendSmartLoading).toHaveBeenCalledWith(planResponse.id, 3)
expect(wrapper.text()).not.toContain('排柜操作失败')
})
it('uses bordered row actions and keeps push independent from containerNo', () => {