优化
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { showExportTaskCreatedDialog } from './exportTaskCreatedDialog'
|
||||
|
||||
describe('showExportTaskCreatedDialog', () => {
|
||||
beforeEach(() => vi.restoreAllMocks())
|
||||
|
||||
it('offers a direct path to the download center with the task reference', async () => {
|
||||
const confirm = vi.spyOn(ElMessageBox, 'confirm').mockResolvedValue({} as never)
|
||||
|
||||
await expect(showExportTaskCreatedDialog({ taskName: '客户列表', taskNo: 'EXP2084' })).resolves.toBe(true)
|
||||
expect(confirm).toHaveBeenCalledWith(
|
||||
expect.stringContaining('任务编号:EXP2084'),
|
||||
'导出任务已创建',
|
||||
expect.objectContaining({ confirmButtonText: '前往下载中心', cancelButtonText: '留在当前页' }),
|
||||
)
|
||||
})
|
||||
|
||||
it('keeps the user on the current page when the dialog is dismissed', async () => {
|
||||
vi.spyOn(ElMessageBox, 'confirm').mockRejectedValue('cancel')
|
||||
|
||||
await expect(showExportTaskCreatedDialog({ taskName: '客户列表' })).resolves.toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user