diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/frontend/sidebar/components/reviewers/sidebar_reviewers_spec.js | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/frontend/sidebar/components/reviewers/sidebar_reviewers_spec.js')
-rw-r--r-- | spec/frontend/sidebar/components/reviewers/sidebar_reviewers_spec.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/frontend/sidebar/components/reviewers/sidebar_reviewers_spec.js b/spec/frontend/sidebar/components/reviewers/sidebar_reviewers_spec.js index a221d28704b..ae31e60254f 100644 --- a/spec/frontend/sidebar/components/reviewers/sidebar_reviewers_spec.js +++ b/spec/frontend/sidebar/components/reviewers/sidebar_reviewers_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import Vue from 'vue'; +import Vue, { nextTick } from 'vue'; import axios from 'axios'; import AxiosMockAdapter from 'axios-mock-adapter'; import VueApollo from 'vue-apollo'; @@ -8,8 +8,11 @@ import SidebarReviewers from '~/sidebar/components/reviewers/sidebar_reviewers.v import SidebarService from '~/sidebar/services/sidebar_service'; import SidebarMediator from '~/sidebar/sidebar_mediator'; import SidebarStore from '~/sidebar/stores/sidebar_store'; +import { fetchUserCounts } from '~/super_sidebar/user_counts_fetch'; import Mock from '../../mock_data'; +jest.mock('~/super_sidebar/user_counts_fetch'); + Vue.use(VueApollo); describe('sidebar reviewers', () => { @@ -39,7 +42,7 @@ describe('sidebar reviewers', () => { axiosMock = new AxiosMockAdapter(axios); mediator = new SidebarMediator(Mock.mediator); - jest.spyOn(mediator, 'saveReviewers'); + jest.spyOn(mediator, 'saveReviewers').mockResolvedValue({}); jest.spyOn(mediator, 'addSelfReview'); }); @@ -60,6 +63,17 @@ describe('sidebar reviewers', () => { expect(mediator.saveReviewers).toHaveBeenCalled(); }); + it('re-fetches user counts after saving reviewers', async () => { + createComponent(); + + expect(fetchUserCounts).not.toHaveBeenCalled(); + + wrapper.vm.saveReviewers(); + await nextTick(); + + expect(fetchUserCounts).toHaveBeenCalled(); + }); + it('calls the mediator when "reviewBySelf" method is called', () => { createComponent(); |