diff options
Diffstat (limited to 'spec/javascripts/notes/components/noteable_discussion_spec.js')
-rw-r--r-- | spec/javascripts/notes/components/noteable_discussion_spec.js | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/spec/javascripts/notes/components/noteable_discussion_spec.js b/spec/javascripts/notes/components/noteable_discussion_spec.js index e4d29a3860c..106a4ac2546 100644 --- a/spec/javascripts/notes/components/noteable_discussion_spec.js +++ b/spec/javascripts/notes/components/noteable_discussion_spec.js @@ -42,12 +42,14 @@ describe('noteable_discussion component', () => { const discussion = { ...discussionMock }; discussion.diff_file = mockDiffFile; discussion.diff_discussion = true; - const diffDiscussionVm = new Component({ + + vm.$destroy(); + vm = new Component({ store, propsData: { discussion }, }).$mount(); - expect(diffDiscussionVm.$el.querySelector('.discussion-header')).not.toBeNull(); + expect(vm.$el.querySelector('.discussion-header')).not.toBeNull(); }); describe('actions', () => { @@ -130,4 +132,44 @@ describe('noteable_discussion component', () => { expect(note).toEqual(data); }); }); + + describe('commit discussion', () => { + const commitId = 'razupaltuff'; + + beforeEach(() => { + vm.$destroy(); + + store.state.diffs = { + projectPath: 'something', + }; + + vm.$destroy(); + vm = new Component({ + propsData: { + discussion: { + ...discussionMock, + for_commit: true, + commit_id: commitId, + diff_discussion: true, + diff_file: { + ...mockDiffFile, + }, + }, + renderDiffFile: true, + }, + store, + }).$mount(); + }); + + it('displays a monospace started a discussion on commit', () => { + const truncatedCommitId = commitId.substr(0, 8); + + expect(vm.$el).toContainText(`started a discussion on commit ${truncatedCommitId}`); + + const commitElement = vm.$el.querySelector('.commit-sha'); + + expect(commitElement).not.toBe(null); + expect(commitElement).toHaveText(truncatedCommitId); + }); + }); }); |