优化
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -67,7 +67,6 @@ const columns: DataTableColumn[] = [
|
||||
{ key: 'requestedAt', label: '申请时间', width: 170, slotName: 'requestedAt' },
|
||||
{ key: 'completedAt', label: '完成时间', width: 170, slotName: 'completedAt' },
|
||||
{ key: 'expiresAt', label: '过期时间', width: 170, slotName: 'expiresAt' },
|
||||
{ key: 'failure', label: '失败原因', minWidth: 240, slotName: 'failure' },
|
||||
]
|
||||
|
||||
const hasActiveTasks = computed(() => result.value.records.some((task) => ['PENDING', 'RUNNING'].includes(task.status)))
|
||||
@@ -267,7 +266,6 @@ onBeforeUnmount(() => {
|
||||
<template #requestedAt="{ row }">{{ formatDate((row as PlatformExportTask).requestedAt) }}</template>
|
||||
<template #completedAt="{ row }">{{ formatDate((row as PlatformExportTask).completedAt) }}</template>
|
||||
<template #expiresAt="{ row }">{{ formatDate((row as PlatformExportTask).expiresAt) }}</template>
|
||||
<template #failure="{ row }"><span class="failure-cell" :class="{ 'failure-message': Boolean((row as PlatformExportTask).failureMessage) }">{{ (row as PlatformExportTask).failureMessage || '—' }}</span></template>
|
||||
</DataTable>
|
||||
</section>
|
||||
</ListPageLayout>
|
||||
|
||||
Reference in New Issue
Block a user