diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-19 17:16:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-19 17:16:28 +0300 |
commit | e4384360a16dd9a19d4d2d25d0ef1f2b862ed2a6 (patch) | |
tree | 2fcdfa7dcdb9db8f5208b2562f4b4e803d671243 /spec/frontend/diffs/components/diff_discussions_spec.js | |
parent | ffda4e7bcac36987f936b4ba515995a6698698f0 (diff) |
Add latest changes from gitlab-org/gitlab@16-2-stable-eev16.2.0-rc42
Diffstat (limited to 'spec/frontend/diffs/components/diff_discussions_spec.js')
-rw-r--r-- | spec/frontend/diffs/components/diff_discussions_spec.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/frontend/diffs/components/diff_discussions_spec.js b/spec/frontend/diffs/components/diff_discussions_spec.js index 73d9f2d6d45..40c617da0aa 100644 --- a/spec/frontend/diffs/components/diff_discussions_spec.js +++ b/spec/frontend/diffs/components/diff_discussions_spec.js @@ -25,11 +25,13 @@ describe('DiffDiscussions', () => { }); }; + const findNoteableDiscussion = () => wrapper.findComponent(NoteableDiscussion); + describe('template', () => { it('should have notes list', () => { createComponent(); - expect(wrapper.findComponent(NoteableDiscussion).exists()).toBe(true); + expect(findNoteableDiscussion().exists()).toBe(true); expect(wrapper.findComponent(DiscussionNotes).exists()).toBe(true); expect( wrapper.findComponent(DiscussionNotes).findAllComponents(TimelineEntryItem).length, @@ -51,11 +53,11 @@ describe('DiffDiscussions', () => { it('dispatches toggleDiscussion when clicking collapse button', () => { createComponent({ shouldCollapseDiscussions: true }); - jest.spyOn(wrapper.vm.$store, 'dispatch').mockImplementation(); - const diffNotesToggle = findDiffNotesToggle(); - diffNotesToggle.trigger('click'); + jest.spyOn(store, 'dispatch').mockImplementation(); + + findDiffNotesToggle().trigger('click'); - expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith('toggleDiscussion', { + expect(store.dispatch).toHaveBeenCalledWith('toggleDiscussion', { discussionId: discussionsMockData.id, }); }); @@ -77,12 +79,12 @@ describe('DiffDiscussions', () => { discussions[0].expanded = false; createComponent({ discussions, shouldCollapseDiscussions: true }); - expect(wrapper.findComponent(NoteableDiscussion).isVisible()).toBe(false); + expect(findNoteableDiscussion().isVisible()).toBe(false); }); it('renders badge on avatar', () => { createComponent({ renderAvatarBadge: true }); - const noteableDiscussion = wrapper.findComponent(NoteableDiscussion); + const noteableDiscussion = findNoteableDiscussion(); expect(noteableDiscussion.find('.design-note-pin').exists()).toBe(true); expect(noteableDiscussion.find('.design-note-pin').text().trim()).toBe('1'); |