优化
This commit is contained in:
@@ -30,9 +30,10 @@ describe('PlatformTenantSelector customer labels', () => {
|
||||
const wrapper = mountSelector({ modelValue: String(customer.id) })
|
||||
await flushPromises()
|
||||
|
||||
expect(listPlatformTenants).toHaveBeenCalledWith({ page: 1, size: 200 })
|
||||
expect(listPlatformTenants).toHaveBeenCalledWith({ page: 1, size: 200, status: 'ACTIVE' })
|
||||
expect(wrapper.text()).toContain('目标客户')
|
||||
expect(document.body.textContent).toContain('柏悦物流(CUS-008) · 启用')
|
||||
expect(document.body.textContent).toContain('柏悦物流 · 启用')
|
||||
expect(document.body.textContent).not.toContain('CUS-008')
|
||||
expect(document.body.textContent).not.toContain(String(customer.id))
|
||||
})
|
||||
|
||||
@@ -44,21 +45,33 @@ describe('PlatformTenantSelector customer labels', () => {
|
||||
expect(wrapper.text()).not.toContain(String(customer.id))
|
||||
})
|
||||
|
||||
it('keeps non-active customers out of the selectable options', async () => {
|
||||
vi.mocked(listPlatformTenants).mockResolvedValue({
|
||||
records: [customer, { ...customer, id: '9', tenantName: '停用客户', status: 'DISABLED' }],
|
||||
page: 1, size: 200, total: 2, pages: 1,
|
||||
})
|
||||
mountSelector({ modelValue: String(customer.id) })
|
||||
await flushPromises()
|
||||
|
||||
expect(document.body.textContent).toContain('柏悦物流 · 启用')
|
||||
expect(document.body.textContent).not.toContain('停用客户')
|
||||
})
|
||||
|
||||
it('safely degrades labels when customer name or code is missing', async () => {
|
||||
vi.mocked(listPlatformTenants).mockResolvedValue({
|
||||
records: [
|
||||
{ ...customer, id: '1', tenantName: '', tenantCode: 'CUS-001', status: 'PENDING' },
|
||||
{ ...customer, id: '2', tenantName: '远航供应链', tenantCode: '', status: 'REJECTED' },
|
||||
{ ...customer, id: '3', tenantName: '', tenantCode: '', status: 'UNKNOWN' },
|
||||
{ ...customer, id: '1', tenantName: '', tenantCode: 'CUS-001', status: 'ACTIVE' },
|
||||
{ ...customer, id: '2', tenantName: '远航供应链', tenantCode: '', status: 'ACTIVE' },
|
||||
{ ...customer, id: '3', tenantName: '', tenantCode: '', status: 'ACTIVE' },
|
||||
],
|
||||
page: 1, size: 200, total: 3, pages: 1,
|
||||
})
|
||||
mountSelector({ modelValue: '1' })
|
||||
await flushPromises()
|
||||
|
||||
expect(document.body.textContent).toContain('CUS-001 · 待审核')
|
||||
expect(document.body.textContent).toContain('远航供应链 · 已驳回')
|
||||
expect(document.body.textContent).toContain('未命名客户 · UNKNOWN')
|
||||
expect(document.body.textContent).toContain('未命名客户 · 启用')
|
||||
expect(document.body.textContent).toContain('远航供应链 · 启用')
|
||||
expect(document.body.textContent).not.toContain('CUS-001')
|
||||
expect(document.body.textContent).not.toMatch(/[((][123] ·/)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user