import { mount } from '@vue/test-utils' import { expect, it } from 'vitest' import DispatchAppointments from './DispatchAppointments.vue' import type { FbaAppointment } from '../dispatchContracts' it('shows each destination once and keeps all shipment numbers from its grouped projection', () => { const first: FbaAppointment = { batchKey: 'FBA_APPOINTMENT:1', batchNo: 'AP-1', customerId: 'A', appointmentNo: 'CONF-1', destinationKey: 'FBA:ONT8', destinationWarehouseCode: 'ONT8', status: 'SUCCESS', confirmedAt: '2026-10-25T17:00:00Z', blockReason: null, shipmentNumbers: ['SHIP-1', 'SHIP-2'] } const wrapper = mount(DispatchAppointments, { props: { appointments: [first, { ...first, destinationKey: 'FBA:LGB8', destinationWarehouseCode: 'LGB8', batchKey: 'FBA_APPOINTMENT:2', shipmentNumbers: ['SHIP-3'] }] } }) expect(wrapper.findAll('tbody tr')).toHaveLength(2) expect(wrapper.text()).toContain('SHIP-1、SHIP-2'); expect(wrapper.text()).toContain('SHIP-3') expect(wrapper.text()).not.toContain('FBA_APPOINTMENT:') }) it('shows missing confirmation as a dash and never substitutes a batch number or planned time', () => { const wrapper = mount(DispatchAppointments, { props: { appointments: [{ batchKey: 'FBA_APPOINTMENT:1', customerId: 'A', shipmentNumbers: [], batchNo: 'AP-PLAN', appointmentNo: null, destinationKey: 'FBA:ONT8', destinationWarehouseCode: null, status: 'PENDING', confirmedAt: null, blockReason: null }] } }) expect(wrapper.findAll('tbody td').map(cell => cell.text())).toEqual(['—', '—', '—', '—']) expect(wrapper.text()).not.toContain('AP-PLAN') })