From e4384360a16dd9a19d4d2d25d0ef1f2b862ed2a6 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 19 Jul 2023 14:16:28 +0000 Subject: Add latest changes from gitlab-org/gitlab@16-2-stable-ee --- spec/frontend/diffs/components/diff_discussions_spec.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'spec/frontend/diffs/components/diff_discussions_spec.js') 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'); -- cgit v1.2.3