This commit is contained in:
2026-10-15 18:25:23 +08:00
parent af2e1481a6
commit 538970797d
3 changed files with 28 additions and 6 deletions
@@ -29,6 +29,23 @@ function fixture(): WarehouseTransferDetailDto {
beforeEach(() => { vi.mocked(getWarehouseTransfer).mockReset(); vi.mocked(getWarehouseTransferCartonLabel).mockReset() })
afterEach(() => vi.restoreAllMocks())
describe('转运预报与实际签收明细', () => {
it('shows every SKU in a mixed box and counts its physical measurements once', async () => {
const value = fixture()
value.cartons = [{ ...value.cartons[0]!, quantity: 10, items: [{ transferItemId: '10', skuCode: 'SKU-A', quantity: 3 }, { transferItemId: '20', skuCode: 'SKU-B', quantity: 7 }] }]
value.pallets = [value.pallets[0]!]
vi.mocked(getWarehouseTransfer).mockResolvedValue(value)
const wrapper = render(); await flushPromises()
expect(wrapper.emitted('summary')!.at(-1)![0]).toMatchObject({ boxes: 1, skus: 2, quantity: 10, weight: 2.5, volume: .1 })
const comparison = wrapper.findAllComponents(DataTableStub)[0]!.props('data')
expect(comparison[0]).toMatchObject({ receivedQuantity: 3, receivedBoxes: 1 })
expect(comparison[1]).toMatchObject({ receivedQuantity: 7, receivedBoxes: 1 })
expect(wrapper.findAll('.test-table')[1]!.text()).toContain('SKU-A × 3 件;SKU-B × 7 件')
await wrapper.findAll('button').find(button => button.text() === '查看箱号明细')!.trigger('click')
await wrapper.findAll('button').find(button => button.text() === '箱内明细')!.trigger('click')
const contents = wrapper.findAll('[data-test="box-dialog"]')[1]!.text()
expect(contents).toContain('SKU-A'); expect(contents).toContain('SKU-B')
expect(contents).toContain('产品 A'); expect(contents).toContain('产品 B')
})
it('keeps declarations separate and totals only counted boxes across pallets', async () => {
vi.mocked(getWarehouseTransfer).mockResolvedValue(fixture())
const wrapper = render(); await flushPromises()