This commit is contained in:
2026-08-26 11:10:48 +08:00
parent 53c92d4d37
commit c38e538a95
14 changed files with 301 additions and 235 deletions
@@ -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' }],