优化
This commit is contained in:
@@ -45,6 +45,28 @@ describe('PlatformTenantSelector customer labels', () => {
|
||||
expect(wrapper.text()).not.toContain(String(customer.id))
|
||||
})
|
||||
|
||||
it('selects the first active customer without preferring a fixed customer id', async () => {
|
||||
vi.mocked(listPlatformTenants).mockResolvedValue({
|
||||
records: [
|
||||
{ ...customer, id: '9', tenantName: '停用客户', status: 'DISABLED' },
|
||||
{ ...customer, id: '20002', tenantName: '首个客户' },
|
||||
{ ...customer, id: '10001', tenantName: '后续客户' },
|
||||
],
|
||||
page: 1, size: 200, total: 3, pages: 1,
|
||||
})
|
||||
const wrapper = mountSelector()
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.emitted('update:modelValue')).toEqual([['20002']])
|
||||
})
|
||||
|
||||
it('preserves an explicitly selected customer', async () => {
|
||||
const wrapper = mountSelector({ modelValue: String(customer.id) })
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.emitted('update:modelValue')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('keeps non-active customers out of the selectable options', async () => {
|
||||
vi.mocked(listPlatformTenants).mockResolvedValue({
|
||||
records: [customer, { ...customer, id: '9', tenantName: '停用客户', status: 'DISABLED' }],
|
||||
|
||||
Reference in New Issue
Block a user