1
This commit is contained in:
@@ -891,6 +891,41 @@ describe('GlobalSmartLoadingView', () => {
|
||||
expect(listSmartLoadingCandidates).toHaveBeenCalledWith({ channelGroupCodes: ['MATSON_CLX'], page: 1, size: 20 })
|
||||
})
|
||||
|
||||
it('keeps assignment failures and diagnostic IDs inside the open dialog without losing the quantity', async () => {
|
||||
vi.spyOn(ElMessage, 'error').mockImplementation(() => undefined as never)
|
||||
vi.mocked(assignSmartLoadingItem).mockRejectedValueOnce(new AxiosError(
|
||||
'forbidden', 'ERR_BAD_REQUEST', undefined, undefined,
|
||||
{ data: { code: 'A0403', message: 'Access denied', requestId: 'assign-request', traceId: 'assign-trace' }, status: 403, statusText: 'Forbidden', headers: {}, config: {} as never },
|
||||
))
|
||||
const wrapper = mount(GlobalSmartLoadingView, { attachTo: document.body, global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
await wrapper.get('.candidate-pane .el-table__body-wrapper').findAll('button').find(button => button.text() === '加入')!.trigger('click')
|
||||
await flushPromises()
|
||||
const popup = wrapper.getComponent(AppDialog)
|
||||
const input = popup.getComponent(ElInputNumber)
|
||||
input.vm.$emit('update:modelValue', 7)
|
||||
await flushPromises()
|
||||
|
||||
// 箱数与上方资料使用同一标签列,保留输入名称与原范围。
|
||||
const label = popup.get('label[for="global-loading-assignment-count"]')
|
||||
expect(label.element.parentElement?.tagName).toBe('TH')
|
||||
expect(label.element.parentElement?.nextElementSibling?.getAttribute('colspan')).toBe('3')
|
||||
expect(popup.find('input#global-loading-assignment-count').exists()).toBe(true)
|
||||
expect(input.props('max')).toBe(candidate.availablePackageCount)
|
||||
popup.vm.$emit('confirm')
|
||||
await flushPromises()
|
||||
|
||||
expect(assignSmartLoadingItem).toHaveBeenCalledWith(plan.id, { inboundId: candidate.inboundId, packageCount: 7, expectedVersion: plan.version })
|
||||
expect(popup.props('modelValue')).toBe(true)
|
||||
expect(input.props('modelValue')).toBe(7)
|
||||
expect(popup.text()).toContain('加入当前柜次失败')
|
||||
expect(popup.text()).toContain('当前账号无权访问该数据')
|
||||
expect(popup.text()).toContain('assign-request')
|
||||
expect(popup.text()).toContain('assign-trace')
|
||||
expect(wrapper.get('.global-loading-page').findAll('.load-error-state')).toHaveLength(1)
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('refreshes the latest plan after A0409 without losing the selected container', async () => {
|
||||
const warningMessage = vi.spyOn(ElMessage, 'warning').mockImplementation(() => undefined as never)
|
||||
const wrapper = mount(GlobalSmartLoadingView, { global: { plugins: [ElementPlus] } })
|
||||
|
||||
Reference in New Issue
Block a user