This commit is contained in:
2026-08-15 11:15:00 +08:00
parent 4573b3df1c
commit e000f8bed2
4 changed files with 23 additions and 29 deletions
@@ -19,8 +19,8 @@ vi.mock('@/shared/api/http', () => ({
const payload: SavePlatformPartnerRequest = {
partnerCode: 'CUS-001',
partnerName: '测试往来单位',
partnerType: 'CUSTOMER',
types: ['CUSTOMER', 'SHIPPER'],
partnerType: 'SHIPPER',
types: ['SHIPPER'],
contactName: '测试联系人',
contactPhone: '13800000000',
contactEmail: null,
@@ -40,10 +40,10 @@ describe('platform partner API', () => {
it('queries the platform partner page with filters only', async () => {
vi.mocked(http.get).mockResolvedValue({ code: '200', message: 'success', data: { records: [], page: '1', size: '20', total: '1', pages: '1' } })
const result = await listPlatformPartners({ page: 1, size: 20, keyword: '测试', type: 'CUSTOMER', status: 'ACTIVE' })
const result = await listPlatformPartners({ page: 1, size: 20, keyword: '测试', type: 'SHIPPER', status: 'ACTIVE' })
expect(http.get).toHaveBeenCalledWith('/platform/v1/partners', {
params: { page: 1, size: 20, keyword: '测试', type: 'CUSTOMER', status: 'ACTIVE' },
params: { page: 1, size: 20, keyword: '测试', type: 'SHIPPER', status: 'ACTIVE' },
})
expect(result).toMatchObject({ page: 1, size: 20, total: 1, pages: 1 })
})
@@ -66,7 +66,7 @@ describe('platform partner API', () => {
vi.mocked(http.get)
.mockResolvedValueOnce({ code: '200', message: 'success', data: {
id: '19001', tenantId: 0, dataScopeId: 0, partnerCode: 'CUS-001', partnerName: '测试单位',
partnerType: 'BOTH', contactName: '张三', contactPhone: '13800000000', contactEmail: null,
partnerType: 'CONSIGNEE', contactName: '张三', contactPhone: '13800000000', contactEmail: null,
countryCode: 'CN', province: null, city: '深圳市', district: null, addressLine: '测试地址',
postalCode: null, status: 'ACTIVE',
} })
@@ -80,7 +80,7 @@ describe('platform partner API', () => {
const file = new File(['xlsx'], 'partners.xlsx')
const result = await importPlatformPartners(file)
expect(detail.types).toEqual(['CUSTOMER', 'SUPPLIER'])
expect(detail.types).toEqual(['CONSIGNEE'])
expect(detail.dataScopeId).toBe(0)
expect(template).toBeInstanceOf(Blob)
expect(result.success).toBe(true)