Skip to content

Commit df7c9ce

Browse files
authored
Merge pull request #362 from actiontech/fix/response-type
Fix/response type
2 parents 1d23c35 + e8e1ca2 commit df7c9ce

3 files changed

Lines changed: 1809 additions & 1794 deletions

File tree

src/page/Order/AuditResult/__test__/index.test.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ describe('Order/Detail/AuditResult', () => {
110110
fireEvent.click(screen.getByText('audit.downloadSql'));
111111

112112
expect(download).toBeCalledTimes(1);
113-
expect(download).toBeCalledWith({ task_id: '9999' });
113+
expect(download).toBeCalledWith(
114+
{ task_id: '9999' },
115+
{ responseType: 'blob' }
116+
);
114117
});
115118

116119
test('should send download sql report request when click download sql button', () => {
@@ -124,14 +127,20 @@ describe('Order/Detail/AuditResult', () => {
124127
fireEvent.click(screen.getByText('audit.downloadReport'));
125128

126129
expect(download).toBeCalledTimes(1);
127-
expect(download).toBeCalledWith({ task_id: '9999', no_duplicate: false });
130+
expect(download).toBeCalledWith(
131+
{ task_id: '9999', no_duplicate: false },
132+
{ responseType: 'blob' }
133+
);
128134

129135
const switchElement = getBySelector('.ant-switch');
130136
fireEvent.click(switchElement);
131137
fireEvent.click(screen.getByText('audit.downloadReport'));
132138

133139
expect(download).toBeCalledTimes(2);
134-
expect(download).toBeCalledWith({ task_id: '9999', no_duplicate: true });
140+
expect(download).toBeCalledWith(
141+
{ task_id: '9999', no_duplicate: true },
142+
{ responseType: 'blob' }
143+
);
135144
});
136145

137146
test('should send update sql describe request when user click update describe in table', async () => {

src/page/Order/AuditResult/index.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,22 @@ const AuditResult: React.FC<AuditResultProps> = (props) => {
5858
);
5959

6060
const downloadSql = () => {
61-
task.downloadAuditTaskSQLFileV1({
62-
task_id: `${props.taskId}`,
63-
});
61+
task.downloadAuditTaskSQLFileV1(
62+
{
63+
task_id: `${props.taskId}`,
64+
},
65+
{ responseType: 'blob' }
66+
);
6467
};
6568

6669
const downloadReport = () => {
67-
task.downloadAuditTaskSQLReportV1({
68-
task_id: `${props.taskId}`,
69-
no_duplicate: duplicate,
70-
});
70+
task.downloadAuditTaskSQLReportV1(
71+
{
72+
task_id: `${props.taskId}`,
73+
no_duplicate: duplicate,
74+
},
75+
{ responseType: 'blob' }
76+
);
7177
};
7278

7379
const updateSqlDescribeProtect = useRef(false);

0 commit comments

Comments
 (0)