diff --git a/src/page/Order/AuditResult/__test__/index.test.tsx b/src/page/Order/AuditResult/__test__/index.test.tsx index 756e7b73..dc9290b5 100644 --- a/src/page/Order/AuditResult/__test__/index.test.tsx +++ b/src/page/Order/AuditResult/__test__/index.test.tsx @@ -124,7 +124,10 @@ describe('Order/Detail/AuditResult', () => { fireEvent.click(screen.getByText('audit.downloadSql')); expect(download).toBeCalledTimes(1); - expect(download).toBeCalledWith({ task_id: '9999' }); + expect(download).toBeCalledWith( + { task_id: '9999' }, + { responseType: 'blob' } + ); }); test('should send download sql report request when click download sql button', () => { @@ -138,14 +141,20 @@ describe('Order/Detail/AuditResult', () => { fireEvent.click(screen.getByText('audit.downloadReport')); expect(download).toBeCalledTimes(1); - expect(download).toBeCalledWith({ task_id: '9999', no_duplicate: false }); + expect(download).toBeCalledWith( + { task_id: '9999', no_duplicate: false }, + { responseType: 'blob' } + ); const switchElement = getBySelector('.ant-switch'); fireEvent.click(switchElement); fireEvent.click(screen.getByText('audit.downloadReport')); expect(download).toBeCalledTimes(2); - expect(download).toBeCalledWith({ task_id: '9999', no_duplicate: true }); + expect(download).toBeCalledWith( + { task_id: '9999', no_duplicate: true }, + { responseType: 'blob' } + ); }); test('should send update sql describe request when user click update describe in table', async () => { diff --git a/src/page/Order/AuditResult/index.tsx b/src/page/Order/AuditResult/index.tsx index c7a1f51a..67eefc8a 100644 --- a/src/page/Order/AuditResult/index.tsx +++ b/src/page/Order/AuditResult/index.tsx @@ -93,16 +93,22 @@ const AuditResult: React.FC = (props) => { const cardProps = useMemo(() => { const downloadSql = () => { - task.downloadAuditTaskSQLFileV1({ - task_id: `${props.taskId}`, - }); + task.downloadAuditTaskSQLFileV1( + { + task_id: `${props.taskId}`, + }, + { responseType: 'blob' } + ); }; const downloadReport = () => { - task.downloadAuditTaskSQLReportV1({ - task_id: `${props.taskId}`, - no_duplicate: duplicate, - }); + task.downloadAuditTaskSQLReportV1( + { + task_id: `${props.taskId}`, + no_duplicate: duplicate, + }, + { responseType: 'blob' } + ); }; return mode === 'auditRecordDetail'