This commit is contained in:
2026-08-19 09:42:12 +08:00
parent 80cfca5056
commit 0cd13f0b4d
18 changed files with 86 additions and 50 deletions
@@ -31,6 +31,19 @@ describe('container fee API', () => {
expect(listSuppliers).toHaveBeenCalledWith({ status: 'ACTIVE', category: 'TRUCKING', page: 1, size: 200 })
})
it('loads every ACTIVE supplier without a category filter when the fee item category is empty', async () => {
vi.mocked(listSuppliers).mockResolvedValue({ records: [
{ id: '41', name: '承运商A', status: 'ACTIVE', category: 'TRUCKING' },
{ id: '42', name: '停用承运商', status: 'INACTIVE', category: 'TRUCKING' },
{ id: '43', name: '报关行', status: 'ACTIVE', category: 'CUSTOMS' },
], page: 1, size: 200, total: 3, pages: 1 } as never)
await expect(listContainerFeeSupplierOptions(null)).resolves.toEqual([
{ id: '41', supplierName: '承运商A', category: 'TRUCKING' },
{ id: '43', supplierName: '报关行', category: 'CUSTOMS' },
])
expect(listSuppliers).toHaveBeenCalledWith({ status: 'ACTIVE', category: undefined, page: 1, size: 200 })
})
it('reads allocation rows from Finance and never calculates them', async () => {
const get = vi.spyOn(http, 'get')
.mockResolvedValueOnce({ code: '200', data: [{ id: 81, customerId: 11, containerId: 99 }, { id: 82, customerId: 11, containerId: 100 }] })