diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-26 21:11:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-26 21:11:56 +0300 |
commit | ea413f31cf00268c71bfab1351b92f75e72c9a80 (patch) | |
tree | 40d55fd066fd6ef9d901d66f006bde24ee2836bb /spec/frontend | |
parent | 5ef8690cb95a549153572811313b1401e77cef2d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/work_items/components/work_item_award_emoji_spec.js | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/spec/frontend/work_items/components/work_item_award_emoji_spec.js b/spec/frontend/work_items/components/work_item_award_emoji_spec.js index f8c5f8edc4c..a756bfa6889 100644 --- a/spec/frontend/work_items/components/work_item_award_emoji_spec.js +++ b/spec/frontend/work_items/components/work_item_award_emoji_spec.js @@ -9,7 +9,8 @@ import { isLoggedIn } from '~/lib/utils/common_utils'; import AwardList from '~/vue_shared/components/awards_list.vue'; import WorkItemAwardEmoji from '~/work_items/components/work_item_award_emoji.vue'; import updateAwardEmojiMutation from '~/work_items/graphql/update_award_emoji.mutation.graphql'; -import workItemAwardEmojiQuery from '~/work_items/graphql/award_emoji.query.graphql'; +import groupWorkItemAwardEmojiQuery from '~/work_items/graphql/group_award_emoji.query.graphql'; +import projectWorkItemAwardEmojiQuery from '~/work_items/graphql/award_emoji.query.graphql'; import { EMOJI_THUMBSUP, EMOJI_THUMBSDOWN, @@ -42,6 +43,7 @@ describe('WorkItemAwardEmoji component', () => { const workItemQueryResponse = workItemByIidResponseFactory(); const mockWorkItem = workItemQueryResponse.data.workspace.workItems.nodes[0]; + const groupAwardEmojiQuerySuccessHandler = jest.fn().mockResolvedValue(workItemQueryResponse); const awardEmojiQuerySuccessHandler = jest.fn().mockResolvedValue(workItemQueryResponse); const awardEmojiQueryEmptyHandler = jest.fn().mockResolvedValue( workItemByIidResponseFactory({ @@ -83,10 +85,12 @@ describe('WorkItemAwardEmoji component', () => { awardEmojiQueryHandler = awardEmojiQuerySuccessHandler, awardEmojiMutationHandler = awardEmojiAddSuccessHandler, workItemIid = '1', + isGroup = false, } = {}) => { mockApolloProvider = createMockApollo( [ - [workItemAwardEmojiQuery, awardEmojiQueryHandler], + [projectWorkItemAwardEmojiQuery, awardEmojiQueryHandler], + [groupWorkItemAwardEmojiQuery, groupAwardEmojiQuerySuccessHandler], [updateAwardEmojiMutation, awardEmojiMutationHandler], ], {}, @@ -108,6 +112,9 @@ describe('WorkItemAwardEmoji component', () => { wrapper = shallowMount(WorkItemAwardEmoji, { isLoggedIn: isLoggedIn(), apolloProvider: mockApolloProvider, + provide: { + isGroup, + }, propsData: { workItemId: 'gid://gitlab/WorkItem/1', workItemFullpath: 'test-project-path', @@ -270,7 +277,7 @@ describe('WorkItemAwardEmoji component', () => { }; }); - it('calls mutation succesfully and adds the award emoji with proper user details', async () => { + it('calls mutation successfully and adds the award emoji with proper user details', async () => { createComponent({ awardEmojiMutationHandler: awardEmojiAddSuccessHandler, }); @@ -345,4 +352,18 @@ describe('WorkItemAwardEmoji component', () => { }); }); }); + + describe('group award emoji query', () => { + it('is not called in a project context', () => { + createComponent(); + + expect(groupAwardEmojiQuerySuccessHandler).not.toHaveBeenCalled(); + }); + + it('is called in a group context', () => { + createComponent({ isGroup: true }); + + expect(groupAwardEmojiQuerySuccessHandler).toHaveBeenCalled(); + }); + }); }); |