优化
This commit is contained in:
@@ -391,6 +391,37 @@ describe('CustomersView', () => {
|
||||
expect(document.body.textContent).toContain('Temporary#2026')
|
||||
})
|
||||
|
||||
it('loads and previews authenticated qualification files in the review dialog', async () => {
|
||||
const auth = useAuthStore()
|
||||
auth.permissions = [...auth.permissions, 'platform:customer:review', 'platform:customer:approve']
|
||||
useAccessPreviewStore().initializeAfterLogin()
|
||||
vi.mocked(listPlatformTenants).mockResolvedValue({
|
||||
records: [{ ...fullTenant, status: 'PENDING' }], page: 1, size: 10, total: 1, pages: 1,
|
||||
})
|
||||
vi.mocked(listEnterpriseReviews).mockResolvedValue([pendingReview])
|
||||
vi.mocked(listTenantQualifications).mockResolvedValue([
|
||||
{ id: 'qualification-license', tenantId: fullTenant.id, qualificationType: 'BUSINESS_LICENSE', certificateNo: fullTenant.unifiedSocialCreditCode, documentUrl: '/files/license.png', status: 'PENDING', reviewComment: null, validTo: null },
|
||||
{ id: 'qualification-legal', tenantId: fullTenant.id, qualificationType: 'LEGAL_PERSON_ID', certificateNo: null, documentUrl: '/files/legal-person.png', status: 'PENDING', reviewComment: null, validTo: null },
|
||||
])
|
||||
vi.mocked(downloadTenantQualification).mockResolvedValue(new Blob(['image'], { type: 'image/png' }))
|
||||
|
||||
mount(CustomersView, { attachTo: document.body, global: { plugins: [pinia, ElementPlus] } })
|
||||
await flushPromises()
|
||||
tableButtonByText('审核')?.click()
|
||||
await flushPromises()
|
||||
|
||||
expect(listTenantQualifications).toHaveBeenCalledWith(fullTenant.id)
|
||||
expect(document.body.textContent).toContain('营业执照')
|
||||
expect(document.body.textContent).toContain('法人身份证')
|
||||
const previewButton = [...document.querySelectorAll<HTMLButtonElement>('.review-document-actions button')]
|
||||
.find((button) => button.textContent?.trim() === '预览')
|
||||
previewButton?.click()
|
||||
await flushPromises()
|
||||
|
||||
expect(downloadTenantQualification).toHaveBeenCalledWith(fullTenant.id, '/files/license.png')
|
||||
expect(document.querySelector<HTMLImageElement>('img[alt="license.png预览"]')?.src).toBe('blob:qualification-preview')
|
||||
})
|
||||
|
||||
it('keeps the client registration account as administrator after approval', async () => {
|
||||
const auth = useAuthStore()
|
||||
auth.permissions = [...auth.permissions, 'platform:customer:review', 'platform:customer:approve']
|
||||
|
||||
Reference in New Issue
Block a user