This commit is contained in:
2026-08-12 17:29:35 +08:00
parent 16c5ed6301
commit d2a246b122
25 changed files with 238 additions and 69 deletions
@@ -92,6 +92,20 @@ enableAutoUnmount(afterEach)
afterAll(() => vi.unstubAllGlobals())
describe('PartnersView real API integration', () => {
it('keeps operation first and separates the prototype contact columns', () => {
const actionsIndex = source.indexOf("{ key: 'actions', label: '操作'")
const nameIndex = source.indexOf("{ key: 'partner', label: '单位名称'")
const typeIndex = source.indexOf("{ key: 'type', label: '类型'")
const contactIndex = source.indexOf("{ key: 'contact', prop: 'contactName', label: '联系人'")
const phoneIndex = source.indexOf("{ key: 'contactPhone', prop: 'contactPhone', label: '电话'")
expect([actionsIndex, nameIndex, typeIndex, contactIndex, phoneIndex].every((index) => index >= 0)).toBe(true)
expect(actionsIndex).toBeLessThan(nameIndex)
expect(nameIndex).toBeLessThan(typeIndex)
expect(typeIndex).toBeLessThan(contactIndex)
expect(contactIndex).toBeLessThan(phoneIndex)
expect(source).toContain("{ key: 'partnerCode', prop: 'partnerCode', label: '单位编码', minWidth: 130, defaultVisible: false }")
expect(source).toContain("{ key: 'contactEmail', prop: 'contactEmail', label: '邮箱', minWidth: 190, defaultVisible: false")
})
beforeEach(() => {
vi.stubGlobal('ResizeObserver', ResizeObserverStub)
document.body.innerHTML = ''
@@ -110,8 +124,9 @@ describe('PartnersView real API integration', () => {
expect(wrapper.find('input[aria-label="所属企业"]').exists()).toBe(false)
expect(wrapper.text()).toContain('平台公共数据 · 共 1 个往来单位')
expect(wrapper.text()).toContain('深圳示例贸易有限公司')
expect(wrapper.text()).toContain('CUS-001')
expect(wrapper.text()).toContain('contact@example.com')
expect(wrapper.find('.data-table').text()).toContain('13800138000')
expect(wrapper.find('.data-table').text()).not.toContain('CUS-001')
expect(wrapper.find('.data-table').text()).not.toContain('contact@example.com')
expect(wrapper.find('.data-table').text()).not.toContain('广东省 深圳市 宝安区 航城街道示例路 1 号')
expect(wrapper.text()).not.toContain('往来单位总数')
expect(wrapper.text()).not.toContain('往来单位档案')