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:
Diffstat (limited to 'spec/frontend/diffs/components/diff_discussions_spec.js')
-rw-r--r--spec/frontend/diffs/components/diff_discussions_spec.js16
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');