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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-25 18:12:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-25 18:12:14 +0300
commit5f85444a43df1c5f025b520fdbc682cbf95d3ca0 (patch)
treea224ff70de072fe19ff19c0bfec2c5cafe966cc5 /spec/frontend/batch_comments
parent73507eaf1a77c5c05ae17c9f7ac29bbeb8bf5be1 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/batch_comments')
-rw-r--r--spec/frontend/batch_comments/components/submit_dropdown_spec.js20
-rw-r--r--spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js3
2 files changed, 20 insertions, 3 deletions
diff --git a/spec/frontend/batch_comments/components/submit_dropdown_spec.js b/spec/frontend/batch_comments/components/submit_dropdown_spec.js
index 4f5ff797230..dc7ecb8e44d 100644
--- a/spec/frontend/batch_comments/components/submit_dropdown_spec.js
+++ b/spec/frontend/batch_comments/components/submit_dropdown_spec.js
@@ -8,7 +8,7 @@ Vue.use(Vuex);
let wrapper;
let publishReview;
-function factory() {
+function factory({ canApprove = true } = {}) {
publishReview = jest.fn();
const store = new Vuex.Store({
@@ -17,7 +17,11 @@ function factory() {
markdownDocsPath: '/markdown/docs',
quickActionsDocsPath: '/quickactions/docs',
}),
- getNoteableData: () => ({ id: 1, preview_note_path: '/preview' }),
+ getNoteableData: () => ({
+ id: 1,
+ preview_note_path: '/preview',
+ current_user: { can_approve: canApprove },
+ }),
noteableType: () => 'merge_request',
},
modules: {
@@ -54,6 +58,8 @@ describe('Batch comments submit dropdown', () => {
noteable_type: 'merge_request',
noteable_id: 1,
note: 'Hello world',
+ approve: false,
+ approval_password: '',
});
});
@@ -66,4 +72,14 @@ describe('Batch comments submit dropdown', () => {
expect(findSubmitButton().props('loading')).toBe(true);
});
+
+ it.each`
+ canApprove | exists | existsText
+ ${true} | ${true} | ${'shows'}
+ ${false} | ${false} | ${'hides'}
+ `('it $existsText approve checkbox if can_approve is $canApprove', ({ canApprove, exists }) => {
+ factory({ canApprove });
+
+ expect(wrapper.findByTestId('approve_merge_request').exists()).toBe(exists);
+ });
});
diff --git a/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js b/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js
index 9f50b12bac2..6369ea9aa15 100644
--- a/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js
+++ b/spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js
@@ -180,6 +180,7 @@ describe('Batch comments store actions', () => {
});
it('calls service with notes data', () => {
+ mock.onAny().reply(200);
jest.spyOn(axios, 'post');
return actions
@@ -192,7 +193,7 @@ describe('Batch comments store actions', () => {
it('dispatches error commits', () => {
mock.onAny().reply(500);
- return actions.publishReview({ dispatch, commit, getters, rootGetters }).then(() => {
+ return actions.publishReview({ dispatch, commit, getters, rootGetters }).catch(() => {
expect(commit.mock.calls[0]).toEqual(['REQUEST_PUBLISH_REVIEW']);
expect(commit.mock.calls[1]).toEqual(['RECEIVE_PUBLISH_REVIEW_ERROR']);
});