This commit is contained in:
2026-08-14 12:50:50 +08:00
parent 590a457dcd
commit f1721b2780
5 changed files with 33 additions and 1 deletions
@@ -14,6 +14,9 @@ const source = readFileSync(resolve(process.cwd(), 'src/modules/trucking/pages/T
vi.mock('../api/platformTrucking', () => ({
listTruckAppointments: vi.fn(),
}))
vi.mock('@/modules/iam', () => ({
listPlatformTenants: vi.fn().mockResolvedValue({ records: [], page: 1, size: 200, total: 0, pages: 0 }),
}))
const row: TruckAppointmentResource = {
id: '9001', appointmentNo: 'TA-9001', status: 'DISPATCHED', customerName: '示例企业', orderNo: 'ORD-1', containerBookingId: '77',
@@ -34,7 +37,7 @@ describe('TruckAppointmentsView', () => {
it('loads the real list and renders relationship snapshots', async () => {
const wrapper = mount(TruckAppointmentsView, { global: { plugins: [ElementPlus] } })
await flushPromises()
expect(listTruckAppointments).toHaveBeenCalledWith({ page: 1, size: 20, keyword: '', status: '', containerBookingId: '', containerType: '' })
expect(listTruckAppointments).toHaveBeenCalledWith({ page: 1, size: 20, customerId: '', keyword: '', status: '', containerBookingId: '', containerType: '' })
expect(wrapper.text()).toContain('TA-9001')
expect(wrapper.text()).toContain('CONT-1')
expect(wrapper.text()).not.toContain('77')
@@ -119,6 +122,13 @@ describe('TruckAppointmentsView', () => {
expect(source).not.toContain("key: 'payableAmount'")
expect(source).not.toContain("key: 'receivableAmount'")
})
it('filters with an active name-only customer selector and stable customerId', () => {
expect(source).toContain("listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' })")
expect(source).toContain("customer.status === 'ACTIVE'")
expect(source).toContain("customer.legalName?.trim() || customer.tenantName")
expect(source).toContain("customerId: String(model.customerId || '')")
expect(source).not.toContain('customer.tenantCode')
})
it('uses bordered list actions instead of text links', () => {
expect(source).toContain('size="small" type="primary" plain')
expect(source).toContain('size="small" :aria-label="appointmentActionLabel(\'编辑\'')