Skip to content

Commit dc1f8b2

Browse files
committed
[test]: Update unit tests
1 parent caa7997 commit dc1f8b2

File tree

36 files changed

+3714
-148
lines changed

36 files changed

+3714
-148
lines changed

packages/base/src/router/test/__snapshots__/router.base.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ exports[`base/router-base-ee render base route data snap 1`] = `
387387
workflowSqlFileStatementOverview
388388
</div>,
389389
"key": "workflowSqlFileStatementOverview",
390-
"path": ":taskId/files/:fileId/sqls",
390+
"path": ":workflowId/task/:taskId/files/:fileId/sqls",
391391
},
392392
],
393393
"element": <div

packages/base/src/router/test/__snapshots__/router.ce.base.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ exports[`base/router-base-ce render base route data snap 1`] = `
251251
workflowSqlFileStatementOverview
252252
</div>,
253253
"key": "workflowSqlFileStatementOverview",
254-
"path": ":taskId/files/:fileId/sqls",
254+
"path": ":workflowId/task/:taskId/files/:fileId/sqls",
255255
},
256256
],
257257
"element": <div

packages/base/src/router/test/router.ce.sqle.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ describe('base/router-sqle-ce', () => {
170170

171171
it('render SQLFileStatementOverview', async () => {
172172
const { baseElement } = customRender([
173-
`/sqle/project/${projectID}/exec-workflow/123/files/434/sqls`
173+
`/sqle/project/${projectID}/exec-workflow/789/task/123/files/434/sqls`
174174
]);
175175

176176
await act(async () => jest.advanceTimersByTime(300));

packages/base/src/router/test/router.sqle.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ describe('base/router-sqle-ee', () => {
194194

195195
it('render SQLFileStatementOverview', async () => {
196196
const { baseElement } = customRender([
197-
`/sqle/project/${projectID}/exec-workflow/123/files/434/sqls`
197+
`/sqle/project/${projectID}/exec-workflow/789/task/123/files/434/sqls`
198198
]);
199199

200200
await act(async () => jest.advanceTimersByTime(300));

packages/sqle/src/page/SqlExecWorkflow/Detail/__tests__/__snapshots__/index.test.tsx.snap

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,20 @@ exports[`sqle/ExecWorkflow/Detail render current workflow status is wait for exe
672672
<div
673673
class="ant-space ant-space-horizontal ant-space-align-center"
674674
>
675+
<div
676+
class="ant-space-item"
677+
style="margin-right: 8px;"
678+
>
679+
<button
680+
class="ant-btn ant-btn-default ant-btn-sm actiontech-table-actions-button basic-button-wrapper css-geipcv"
681+
hidden=""
682+
type="button"
683+
>
684+
<span>
685+
再次执行
686+
</span>
687+
</button>
688+
</div>
675689
<div
676690
class="ant-space-item"
677691
style="margin-right: 8px;"
@@ -2105,6 +2119,20 @@ exports[`sqle/ExecWorkflow/Detail render snap detail 2`] = `
21052119
<div
21062120
class="ant-space ant-space-horizontal ant-space-align-center"
21072121
>
2122+
<div
2123+
class="ant-space-item"
2124+
style="margin-right: 8px;"
2125+
>
2126+
<button
2127+
class="ant-btn ant-btn-default ant-btn-sm actiontech-table-actions-button basic-button-wrapper css-geipcv"
2128+
hidden=""
2129+
type="button"
2130+
>
2131+
<span>
2132+
再次执行
2133+
</span>
2134+
</button>
2135+
</div>
21082136
<div
21092137
class="ant-space-item"
21102138
style="margin-right: 8px;"
@@ -3030,6 +3058,20 @@ exports[`sqle/ExecWorkflow/Detail render snap detail 3`] = `
30303058
<div
30313059
class="ant-space ant-space-horizontal ant-space-align-center"
30323060
>
3061+
<div
3062+
class="ant-space-item"
3063+
style="margin-right: 8px;"
3064+
>
3065+
<button
3066+
class="ant-btn ant-btn-default ant-btn-sm actiontech-table-actions-button basic-button-wrapper css-geipcv"
3067+
hidden=""
3068+
type="button"
3069+
>
3070+
<span>
3071+
再次执行
3072+
</span>
3073+
</button>
3074+
</div>
30333075
<div
30343076
class="ant-space-item"
30353077
style="margin-right: 8px;"
@@ -3921,6 +3963,20 @@ exports[`sqle/ExecWorkflow/Detail render snap detail when have multiple states 1
39213963
<div
39223964
class="ant-space ant-space-horizontal ant-space-align-center"
39233965
>
3966+
<div
3967+
class="ant-space-item"
3968+
style="margin-right: 8px;"
3969+
>
3970+
<button
3971+
class="ant-btn ant-btn-default ant-btn-sm actiontech-table-actions-button basic-button-wrapper css-geipcv"
3972+
hidden=""
3973+
type="button"
3974+
>
3975+
<span>
3976+
再次执行
3977+
</span>
3978+
</button>
3979+
</div>
39243980
<div
39253981
class="ant-space-item"
39263982
style="margin-right: 8px;"
@@ -4070,6 +4126,20 @@ exports[`sqle/ExecWorkflow/Detail render snap detail when have multiple states 1
40704126
<div
40714127
class="ant-space ant-space-horizontal ant-space-align-center"
40724128
>
4129+
<div
4130+
class="ant-space-item"
4131+
style="margin-right: 8px;"
4132+
>
4133+
<button
4134+
class="ant-btn ant-btn-default ant-btn-sm actiontech-table-actions-button basic-button-wrapper css-geipcv"
4135+
hidden=""
4136+
type="button"
4137+
>
4138+
<span>
4139+
再次执行
4140+
</span>
4141+
</button>
4142+
</div>
40734143
<div
40744144
class="ant-space-item"
40754145
style="margin-right: 8px;"
@@ -4212,6 +4282,19 @@ exports[`sqle/ExecWorkflow/Detail render snap detail when have multiple states 1
42124282
<div
42134283
class="ant-space ant-space-horizontal ant-space-align-center"
42144284
>
4285+
<div
4286+
class="ant-space-item"
4287+
style="margin-right: 8px;"
4288+
>
4289+
<button
4290+
class="ant-btn ant-btn-default ant-btn-sm actiontech-table-actions-button basic-button-wrapper css-geipcv"
4291+
type="button"
4292+
>
4293+
<span>
4294+
再次执行
4295+
</span>
4296+
</button>
4297+
</div>
42154298
<div
42164299
class="ant-space-item"
42174300
style="margin-right: 8px;"

packages/sqle/src/page/SqlExecWorkflow/Detail/__tests__/index.test.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ import {
2525
} from '@actiontech/shared/lib/api/sqle/service/common.enum';
2626
import { getBySelector } from '@actiontech/shared/lib/testUtil/customQuery';
2727
import execWorkflow from '@actiontech/shared/lib/testUtil/mockApi/sqle/execWorkflow';
28-
import { mockUsePermission } from '@actiontech/shared/lib/testUtil/mockHook/mockUsePermission';
2928
import instance from '@actiontech/shared/lib/testUtil/mockApi/sqle/instance';
3029
import {
3130
ignoreConsoleErrors,
3231
UtilsConsoleErrorStringsEnum
3332
} from '@actiontech/shared/lib/testUtil/common';
33+
import { useSelector } from 'react-redux';
34+
import { ModalName } from '../../../../data/ModalName';
3435

3536
jest.mock('react-router-dom', () => {
3637
return {
@@ -89,9 +90,23 @@ describe('sqle/ExecWorkflow/Detail', () => {
8990
);
9091
getAuditTaskSpy = task.getAuditTask();
9192
useParamsMock.mockReturnValue({ workflowId: 'workflowId' });
92-
mockUsePermission(undefined, {
93-
mockSelector: true
94-
});
93+
(useSelector as jest.Mock).mockImplementation((selector) =>
94+
selector({
95+
permission: {
96+
moduleFeatureSupport: {
97+
sqlOptimization: false,
98+
knowledge: false
99+
},
100+
userOperationPermissions: null
101+
},
102+
sqlExecWorkflow: {
103+
retryExecuteData: {},
104+
modalStatus: {
105+
[ModalName.Sql_Exec_Workflow_Retry_Execute_Modal]: false
106+
}
107+
}
108+
})
109+
);
95110
});
96111

97112
afterEach(() => {

packages/sqle/src/page/SqlExecWorkflow/Detail/components/AuditExecResultPanel/OverviewList/__tests__/__snapshots__/index.test.tsx.snap

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,20 @@ exports[`test OverviewList matches the snapshot and displays loading state 1`] =
316316
<div
317317
class="ant-space ant-space-horizontal ant-space-align-center"
318318
>
319+
<div
320+
class="ant-space-item"
321+
style="margin-right: 8px;"
322+
>
323+
<button
324+
class="ant-btn ant-btn-default ant-btn-sm actiontech-table-actions-button basic-button-wrapper css-geipcv"
325+
hidden=""
326+
type="button"
327+
>
328+
<span>
329+
再次执行
330+
</span>
331+
</button>
332+
</div>
319333
<div
320334
class="ant-space-item"
321335
style="margin-right: 8px;"
@@ -463,6 +477,20 @@ exports[`test OverviewList matches the snapshot and displays loading state 1`] =
463477
<div
464478
class="ant-space ant-space-horizontal ant-space-align-center"
465479
>
480+
<div
481+
class="ant-space-item"
482+
style="margin-right: 8px;"
483+
>
484+
<button
485+
class="ant-btn ant-btn-default ant-btn-sm actiontech-table-actions-button basic-button-wrapper css-geipcv"
486+
hidden=""
487+
type="button"
488+
>
489+
<span>
490+
再次执行
491+
</span>
492+
</button>
493+
</div>
466494
<div
467495
class="ant-space-item"
468496
style="margin-right: 8px;"
@@ -1057,6 +1085,20 @@ exports[`test OverviewList matches the snapshot for the default task result setu
10571085
<div
10581086
class="ant-space ant-space-horizontal ant-space-align-center"
10591087
>
1088+
<div
1089+
class="ant-space-item"
1090+
style="margin-right: 8px;"
1091+
>
1092+
<button
1093+
class="ant-btn ant-btn-default ant-btn-sm actiontech-table-actions-button basic-button-wrapper css-geipcv"
1094+
hidden=""
1095+
type="button"
1096+
>
1097+
<span>
1098+
再次执行
1099+
</span>
1100+
</button>
1101+
</div>
10601102
<div
10611103
class="ant-space-item"
10621104
style="margin-right: 8px;"
@@ -1204,6 +1246,20 @@ exports[`test OverviewList matches the snapshot for the default task result setu
12041246
<div
12051247
class="ant-space ant-space-horizontal ant-space-align-center"
12061248
>
1249+
<div
1250+
class="ant-space-item"
1251+
style="margin-right: 8px;"
1252+
>
1253+
<button
1254+
class="ant-btn ant-btn-default ant-btn-sm actiontech-table-actions-button basic-button-wrapper css-geipcv"
1255+
hidden=""
1256+
type="button"
1257+
>
1258+
<span>
1259+
再次执行
1260+
</span>
1261+
</button>
1262+
</div>
12071263
<div
12081264
class="ant-space-item"
12091265
style="margin-right: 8px;"

0 commit comments

Comments
 (0)