This commit is contained in:
2026-09-10 11:17:45 +08:00
parent 6a038c89ca
commit 9b5b324fe8
5 changed files with 79 additions and 8 deletions
+15 -1
View File
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { http } from '@/shared/api/http'
import { downloadInboundCartonLabels, downloadPlatformInboundHoldEvidence, getPlatformInbound, getPlatformInboundHold, holdPlatformInbound, listPlatformInbounds, releasePlatformInbound, uploadPlatformInboundHoldEvidence } from './api'
import { downloadInboundCartonLabels, downloadInboundCartonLabelsBatch, downloadPlatformInboundHoldEvidence, getPlatformInbound, getPlatformInboundHold, holdPlatformInbound, listPlatformInbounds, releasePlatformInbound, uploadPlatformInboundHoldEvidence } from './api'
vi.mock('@/shared/api/http', () => ({
ApiResponseError: class ApiResponseError extends Error {
@@ -117,6 +117,20 @@ describe('platform inbound query API', () => {
})
})
it('downloads one PDF for a cross-customer batch of inbound orders', async () => {
const pdf = new Blob(['pdf'], { type: 'application/pdf' })
vi.mocked(http.post).mockResolvedValueOnce(pdf)
const items = [
{ tenantId: '10001', inboundId: '19001' },
{ tenantId: '10002', inboundId: '19002' },
]
await expect(downloadInboundCartonLabelsBatch(items)).resolves.toBe(pdf)
expect(http.post).toHaveBeenCalledWith('/platform/inbounds/carton-label-pdf', items, {
responseType: 'blob', timeout: 120_000,
})
})
it('loads and normalizes the tenant-scoped hold state and immutable history', async () => {
vi.mocked(http.get).mockResolvedValue({ data: {
inboundId: 19001, tenantId: 10002, holdFlag: true, currentHoldReason: ' 待核对货款 ', version: '4',