Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/admin/abuse_report')
-rw-r--r--spec/frontend/admin/abuse_report/components/report_actions_spec.js31
-rw-r--r--spec/frontend/admin/abuse_report/mock_data.js1
2 files changed, 30 insertions, 2 deletions
diff --git a/spec/frontend/admin/abuse_report/components/report_actions_spec.js b/spec/frontend/admin/abuse_report/components/report_actions_spec.js
index ec7dd31a046..6dd6d0e55c5 100644
--- a/spec/frontend/admin/abuse_report/components/report_actions_spec.js
+++ b/spec/frontend/admin/abuse_report/components/report_actions_spec.js
@@ -154,7 +154,7 @@ describe('ReportActions', () => {
beforeEach(async () => {
jest.spyOn(axios, 'put');
- axiosMock.onPut(report.updatePath).replyOnce(responseStatus, responseData);
+ axiosMock.onPut(report.moderateUserPath).replyOnce(responseStatus, responseData);
selectAction(params.user_action);
setCloseReport(params.close);
@@ -169,7 +169,7 @@ describe('ReportActions', () => {
});
it('does a put call with the right data', () => {
- expect(axios.put).toHaveBeenCalledWith(report.updatePath, params);
+ expect(axios.put).toHaveBeenCalledWith(report.moderateUserPath, params);
});
it('closes the drawer', () => {
@@ -191,4 +191,31 @@ describe('ReportActions', () => {
);
});
});
+
+ describe('when moderateUserPath is not present', () => {
+ it('sends the request to updatePath', async () => {
+ jest.spyOn(axios, 'put');
+ axiosMock.onPut(report.updatePath).replyOnce(HTTP_STATUS_OK, {});
+
+ const reportWithoutModerateUserPath = { ...report };
+ delete reportWithoutModerateUserPath.moderateUserPath;
+
+ createComponent({ report: reportWithoutModerateUserPath });
+
+ clickActionsButton();
+
+ await nextTick();
+
+ selectAction(params.user_action);
+ selectReason(params.reason);
+
+ await nextTick();
+
+ submitForm();
+
+ await waitForPromises();
+
+ expect(axios.put).toHaveBeenCalledWith(report.updatePath, expect.any(Object));
+ });
+ });
});
diff --git a/spec/frontend/admin/abuse_report/mock_data.js b/spec/frontend/admin/abuse_report/mock_data.js
index 8c0ae223c87..8ff0c7d507a 100644
--- a/spec/frontend/admin/abuse_report/mock_data.js
+++ b/spec/frontend/admin/abuse_report/mock_data.js
@@ -51,5 +51,6 @@ export const mockAbuseReport = {
screenshot:
'/uploads/-/system/abuse_report/screenshot/27/Screenshot_2023-03-30_at_16.56.37.png',
updatePath: '/admin/abuse_reports/27',
+ moderateUserPath: '/admin/abuse_reports/27/moderate_user',
},
};