This commit is contained in:
2026-08-12 10:59:49 +08:00
parent fb542e0b6f
commit f9ff9086d5
20 changed files with 103 additions and 81 deletions
@@ -67,7 +67,8 @@ describe('DownloadCenterView', () => {
await flushPromises()
expect(document.body.textContent).toContain('客户列表')
expect(document.querySelector('.failure-cell')?.classList.contains('failure-message')).toBe(false)
expect(document.querySelector('.data-table')?.textContent).not.toContain('失败原因')
expect(document.querySelector('.failure-cell')).toBeNull()
const button = [...document.querySelectorAll<HTMLButtonElement>('button')].find((item) => item.textContent?.trim() === '下载')
button?.click()
await flushPromises()
@@ -91,7 +92,7 @@ describe('DownloadCenterView', () => {
mount(DownloadCenterView, { attachTo: document.body, global: { plugins: [pinia, ElementPlus] } })
await flushPromises()
expect(document.querySelector('.failure-cell')?.classList.contains('failure-message')).toBe(true)
expect(document.querySelector('.failure-cell')).toBeNull()
const button = [...document.querySelectorAll<HTMLButtonElement>('button')].find((item) => item.textContent?.trim() === '重试')
button?.click()
await flushPromises()
@@ -145,7 +146,7 @@ describe('DownloadCenterView', () => {
.some((item) => item.textContent?.trim() === '重试')).toBe(false)
})
it('does not expose customer retry without the customer export permission', async () => {
it('keeps failure details out of the list and does not expose retry without the source export permission', async () => {
vi.mocked(listPlatformExportTasks).mockResolvedValue({
records: [{ ...task, status: 'FAILED', failureMessage: 'IAM timeout' }],
page: 1, size: 20, total: 1, pages: 1,
@@ -155,12 +156,18 @@ describe('DownloadCenterView', () => {
auth.token = 'token'
auth.permissions = ['platform:download:list']
useAccessPreviewStore().initializeAfterLogin()
vi.mocked(getPlatformExportTask).mockResolvedValue({ ...task, status: 'FAILED', failureMessage: 'IAM timeout' })
mount(DownloadCenterView, { attachTo: document.body, global: { plugins: [pinia, ElementPlus] } })
await flushPromises()
expect(document.body.textContent).toContain('IAM timeout')
expect(document.body.textContent).not.toContain('IAM timeout')
expect([...document.querySelectorAll<HTMLButtonElement>('button')]
.some((item) => item.textContent?.trim() === '重试')).toBe(false)
;[...document.querySelectorAll<HTMLButtonElement>('button')]
.find((item) => item.textContent?.trim() === '详情')?.click()
await flushPromises()
expect(document.body.textContent).toContain('IAM timeout')
})
it('announces the initial loading state while the task request is pending', async () => {