This commit is contained in:
2026-08-04 21:01:39 +08:00
parent 88bd939170
commit 5cb1ca307d
77 changed files with 9914 additions and 131 deletions
@@ -5,8 +5,8 @@ import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vites
import { listPlatformExpressCompanies, type PlatformExpressCompanyResource } from '@/modules/master-data/express-companies/api/platformExpressCompanies'
import { useAccessPreviewStore } from '@/core/access/accessPreview'
import { useAuthStore } from '@/core/auth/auth'
import QueryToolbar from '@/shared/components/QueryToolbar.vue'
import { listPlatformTenants, type PlatformTenantResource } from '../../../iam/api/platformIam'
import PlatformTenantSelector from '../../../iam/components/PlatformTenantSelector.vue'
import ExpressCompaniesView from './ExpressCompaniesView.vue'
vi.mock('@/modules/master-data/express-companies/api/platformExpressCompanies', () => ({
@@ -95,9 +95,12 @@ describe('ExpressCompaniesView query and table migration', () => {
const wrapper = await mountView()
expect(wrapper.find('.query-toolbar').exists()).toBe(true)
expect(wrapper.find('input[aria-label="所属企业"]').exists()).toBe(true)
expect(wrapper.find('.data-table').exists()).toBe(true)
expect(wrapper.text()).toContain('顺丰速运')
expect(wrapper.text()).toContain('全部企业 · 共 1 家快递公司')
expect(wrapper.find('.metric-strip').exists()).toBe(false)
expect(listPlatformExpressCompanies).toHaveBeenCalledWith(undefined, 1, 20, '', '')
})
it('does not request with edited filters until search is submitted', async () => {
@@ -110,13 +113,16 @@ describe('ExpressCompaniesView query and table migration', () => {
await searchButton?.trigger('click')
await flushPromises()
expect(listPlatformExpressCompanies).toHaveBeenLastCalledWith(10001, 1, 20, '顺丰', '')
expect(listPlatformExpressCompanies).toHaveBeenLastCalledWith(undefined, 1, 20, '顺丰', '')
})
it('preserves a snowflake tenant id as a string when switching enterprises', async () => {
const wrapper = await mountView()
wrapper.findComponent(PlatformTenantSelector).vm.$emit('update:modelValue', snowflakeTenantId)
const toolbar = wrapper.findComponent(QueryToolbar)
const model = { tenantId: snowflakeTenantId, keyword: '', status: '' }
toolbar.vm.$emit('update:modelValue', model)
toolbar.vm.$emit('search', model)
await flushPromises()
expect(listPlatformExpressCompanies).toHaveBeenLastCalledWith(snowflakeTenantId, 1, 20, '', '')