Skip to content

Commit

Permalink
Merge pull request #361 from actiontech/fix/issue-1404-2
Browse files Browse the repository at this point in the history
[fix](Order): Add responseType parameter to download
  • Loading branch information
LZS911 authored May 24, 2024
2 parents 1a84bf2 + e0c8b5d commit b88ef27
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
15 changes: 12 additions & 3 deletions src/page/Order/AuditResult/__test__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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 () => {
Expand Down
20 changes: 13 additions & 7 deletions src/page/Order/AuditResult/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,22 @@ const AuditResult: React.FC<AuditResultProps> = (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'
Expand Down

0 comments on commit b88ef27

Please sign in to comment.