This commit is contained in:
2026-10-21 16:58:38 +08:00
parent e2f99b4f4b
commit c510cc4e2e
15 changed files with 481 additions and 23 deletions
@@ -19,6 +19,28 @@ 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(['omitted', 'null', 'invalid'] as const)('keeps schedule fields readable when exception records are %s and allows retry', async state => {
const value = detail()
if (state === 'omitted') Reflect.deleteProperty(value.dispatchInfo, 'exceptions')
else Reflect.set(value.dispatchInfo, 'exceptions', state === 'null' ? null : {})
vi.mocked(getDispatch).mockResolvedValueOnce(value)
const renderError = vi.fn()
const wrapper = mount(DispatchDetailView, { global: { ...options.global, config: { errorHandler: renderError } } })
await flushPromises()
await wrapper.get('#tab-dispatch').trigger('click'); await flushPromises()
expect(renderError).not.toHaveBeenCalled()
const pane = wrapper.get('#pane-dispatch')
expect(pane.isVisible()).toBe(true)
expect(pane.text()).toContain('LAX → ONT8')
expect(pane.text()).toContain('派送异常记录读取失败')
expect(pane.findAll('dt').map(field => field.text())).toEqual(['路线', '发车时间', '预计到达时间', 'FBA预约'])
expect(pane.find('[aria-label="派送异常记录"]').exists()).toBe(false)
await pane.get('button').trigger('click'); await flushPromises()
expect(getDispatch).toHaveBeenCalledTimes(2)
expect(wrapper.get('#pane-dispatch').isVisible()).toBe(true)
expect(wrapper.get('#pane-dispatch').text()).not.toContain('派送异常记录读取失败')
wrapper.unmount()
})
it('shows saved review attachments beside resource evidence without providing upload controls', async () => {
const value = detail(); value.vehicleInfo.vehicle!.evidenceFileIds = ['301']
value.reviews.dispatchReview.attachments = { vehicleFileIds: ['301', '302'], driverPhotoFileIds: ['303'], licenseFileIds: [] }