This commit is contained in:
2026-09-17 13:36:31 +08:00
parent 5d00618c53
commit 9c9cb91593
18 changed files with 317 additions and 32 deletions
@@ -159,6 +159,21 @@ async function chooseContainer(wrapper: Awaited<ReturnType<typeof mountView>>) {
}
describe('LastMileOrdersView pending order and container conversion', () => {
it('keeps the original carton count and adds only the signed difference in the list', async () => {
canAccess.mockReturnValue(false)
vi.mocked(listLastMileOrders).mockResolvedValue({ records: [{
id: 'transfer-1', customerId, orderNo: 'WT-1', orderType: 'WAREHOUSE_TRANSFER', currentStatus: 'WAIT_CUSTOMER_CONFIRMATION',
packageCount: 10, receivedPackageCount: 8, packageDifference: -2,
}], page: 1, size: 10, total: 1, pages: 1 })
const wrapper = await mountView()
const table = wrapper.findComponent(DataTable)
const columns = table.props('columns') as Array<{ key: string; label: string }>
expect(columns).toEqual(expect.arrayContaining([expect.objectContaining({ key: 'cartonDifference', label: '差异(箱)' })]))
expect(columns.some((column) => ['declaredCartons', 'receivedCartons'].includes(column.key))).toBe(false)
expect((table.props('data') as Array<{ cartons: unknown }>)[0]?.cartons).toBe(10)
expect(wrapper.get('.package-difference--nonzero').text()).toBe('-2')
})
it.each([
[[], ['查看'], false],
[['inbound-order:create'], ['查看', '入库计划'], false],