优化
This commit is contained in:
@@ -19,6 +19,18 @@ vi.mock('@/modules/overseas-master-data', async () => ({
|
||||
const options = { global: { plugins: [ElementPlus], stubs: { DataTable: DataTableStub, DispatchWorkflowDialog: true, TransportExecutionPanel: true } } }
|
||||
beforeEach(() => { vi.clearAllMocks(); vi.mocked(getDispatch).mockResolvedValue(detail()); can.mockReturnValue(false); push.mockReset(); Object.keys(query).forEach(key => delete query[key]) })
|
||||
describe('whole-dispatch four-tab detail', () => {
|
||||
it.each(['dispatchReview', 'loadingReview'] as const)('keeps the %s rejection readable in the detail', async reviewKey => {
|
||||
const value = detail()
|
||||
value.reviews[reviewKey] = { ...value.reviews[reviewKey], status: 'REJECTED', reason: '司机资料需要更正', invalidatedReason: '资源已修改,待重新提交' }
|
||||
vi.mocked(getDispatch).mockResolvedValue(value)
|
||||
const wrapper = mount(DispatchDetailView, options); await flushPromises()
|
||||
expect(wrapper.text()).toContain('已退回客服处理(车辆信息)')
|
||||
expect(wrapper.text()).toContain('司机资料需要更正')
|
||||
vi.mocked(getDispatch).mockResolvedValue(detail({ recordVersion: 2 }))
|
||||
wrapper.getComponent({ name: 'DispatchWorkflowDialog' }).vm.$emit('saved'); await flushPromises()
|
||||
expect(wrapper.text()).not.toContain('司机资料需要更正')
|
||||
wrapper.unmount()
|
||||
})
|
||||
it('keeps cargo additions and removals out of the detail even when authorized', async () => {
|
||||
can.mockReturnValue(true)
|
||||
vi.mocked(getDispatch).mockResolvedValueOnce(detail({ actions: { EDIT: { allowed: true, blockCode: null, blockReason: null }, ADD_CARGO: { allowed: true, blockCode: null, blockReason: null }, REMOVE_CARGO: { allowed: true, blockCode: null, blockReason: null } } }))
|
||||
@@ -101,18 +113,18 @@ describe('whole-dispatch four-tab detail', () => {
|
||||
})
|
||||
it('keeps the allowed Admin action without presenting unrelated stage or PDA permission refusals as page warnings', async () => {
|
||||
can.mockReturnValue(true)
|
||||
vi.mocked(getDispatch).mockResolvedValueOnce(detail({ stage: 'AFTER_LOADING', actions: {
|
||||
ARRANGE_DELIVERY: { allowed: true, blockCode: null, blockReason: null },
|
||||
vi.mocked(getDispatch).mockResolvedValueOnce(detail({ stage: 'LOADING', actions: {
|
||||
LOADING_COMPLETE: { allowed: true, blockCode: null, blockReason: null },
|
||||
EDIT: { allowed: false, blockCode: 'STAGE', blockReason: '当前阶段或作业事实不满足操作条件' },
|
||||
PICK: { allowed: false, blockCode: 'PERMISSION', blockReason: '当前无此操作权限' },
|
||||
} }))
|
||||
const wrapper = mount(DispatchDetailView, options); await flushPromises()
|
||||
expect(wrapper.text()).toContain('装车后')
|
||||
expect(wrapper.text()).toContain('装车中')
|
||||
expect(wrapper.text()).not.toContain('当前阶段或作业事实不满足操作条件')
|
||||
expect(wrapper.text()).not.toContain('当前无此操作权限')
|
||||
expect(wrapper.findAll('button').some(button => button.text() === '维护车辆信息')).toBe(false)
|
||||
await wrapper.findAll('button').find(button => button.text() === '安排派送')!.trigger('click')
|
||||
expect(wrapper.findComponent({ name: 'DispatchWorkflowDialog' }).props()).toMatchObject({ modelValue: true, dispatchNo: 'PC/1', action: 'ARRANGE_DELIVERY' })
|
||||
await wrapper.findAll('button').find(button => button.text() === '确认装车完成')!.trigger('click')
|
||||
expect(wrapper.findComponent({ name: 'DispatchWorkflowDialog' }).props()).toMatchObject({ modelValue: true, dispatchNo: 'PC/1', action: 'LOADING_COMPLETE' })
|
||||
wrapper.unmount()
|
||||
})
|
||||
it('retains a real attachment A0404 failure and its request diagnostics in the vehicle tab', async () => {
|
||||
|
||||
Reference in New Issue
Block a user