This commit is contained in:
2026-08-27 11:08:03 +08:00
parent 506d310211
commit 82f0479928
7 changed files with 136 additions and 24 deletions
@@ -93,6 +93,18 @@ describe('inbound weight OCR API', () => {
)
})
it('passes an abort signal without changing the frozen pallet endpoint parameters', async () => {
vi.mocked(http.get).mockResolvedValue({ code: '200', message: 'success', data: [] })
const controller = new AbortController()
await getWeightPalletOptions('10001', '20001', controller.signal)
expect(http.get).toHaveBeenCalledWith(
'/platform/v1/first-leg/inbounds/20001/weight-pallet-options',
{ params: { tenantId: '10001' }, signal: controller.signal },
)
})
it('registers, corrects, and confirms a weight result using the implemented contracts', async () => {
vi.mocked(http.post).mockResolvedValue({ code: '200', message: 'success', data: { id: '1' } })
vi.mocked(http.put).mockResolvedValue({ code: '200', message: 'success', data: { id: '1', version: 1 } })
+2 -2
View File
@@ -60,10 +60,10 @@ export async function getWeightWorkspace(tenantId: string, inboundId: string) {
return unwrapApiResponse(response)
}
export async function getWeightPalletOptions(tenantId: string, inboundId: string) {
export async function getWeightPalletOptions(tenantId: string, inboundId: string, signal?: AbortSignal) {
const response = await http.get<ApiEnvelope<WeightPalletOption[]>, ApiEnvelope<WeightPalletOption[]>>(
`${measurementBasePath}/${segment(inboundId)}/weight-pallet-options`,
{ params: { tenantId } },
{ params: { tenantId }, ...(signal ? { signal } : {}) },
)
return unwrapApiResponse(response)
}