diff --git a/src/modules/container-loading/api/platformContainerCustoms.test.ts b/src/modules/container-loading/api/platformContainerCustoms.test.ts index 0c2959f5..5f2b760b 100644 --- a/src/modules/container-loading/api/platformContainerCustoms.test.ts +++ b/src/modules/container-loading/api/platformContainerCustoms.test.ts @@ -22,6 +22,12 @@ describe('platform container customs API', () => { expect(result.documents[0]?.documentId).toBe('2092438843630391407') }) + it('returns null while the loading plan is not completed', async () => { + vi.spyOn(http, 'get').mockResolvedValue({ code: '200', message: 'ok', data: null }) + + await expect(getContainerCustoms('2097922185010147329')).resolves.toBeNull() + }) + it('sends confirmed start and all-buy completion with optimistic version and idempotency', async () => { const post = vi.spyOn(http, 'post').mockResolvedValue({ code: '200', message: 'ok', data: customs }) await startContainerCustoms('2092438843630391402', 3) diff --git a/src/modules/container-loading/components/ContainerCustomsPanel.test.ts b/src/modules/container-loading/components/ContainerCustomsPanel.test.ts index d181f38c..2e63b4d2 100644 --- a/src/modules/container-loading/components/ContainerCustomsPanel.test.ts +++ b/src/modules/container-loading/components/ContainerCustomsPanel.test.ts @@ -92,6 +92,18 @@ describe('ContainerCustomsPanel', () => { expect(buttonTexts(wrapper)).not.toContain('导出买单 XLSX') }) + it('shows a pending state instead of an error before loading is completed', async () => { + api.get.mockResolvedValue(null) + const wrapper = mount(ContainerCustomsPanel, { + props: { loadingPlanId: '2097922185010147329', canList: true, canManage: false, departureState: 'WAITING_OTHER_GATES' }, + global: { plugins: [ElementPlus] }, + }) + await flushPromises() + + expect(wrapper.text()).toContain('当前装柜计划尚未完成,完成装柜后可处理报关') + expect(wrapper.text()).not.toContain('整柜报关加载失败') + }) + it('allows completion upload and overwrite only while DECLARING with manage permission', async () => { let wrapper = await render('DECLARING', true, false) expect(wrapper.text()).toContain('上传报关完成文件')