diff options
author | Phil Hughes <me@iamphill.com> | 2018-04-09 15:27:09 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-04-09 15:27:09 +0000 |
commit | 9e13ca6a3a5b538001e55349dd4a23a47a84be2b (patch) | |
tree | 6e766593043d28de7805e05fa85b18d10940d78b /spec | |
parent | de3f55b226b4c5bb28b207b422582c6e2bfd417f (diff) | |
parent | ab61eca7168602bbb4a80df673f7c74c7ccd84df (diff) | |
download | gitlab-ce-9e13ca6a3a5b538001e55349dd4a23a47a84be2b.tar.gz |
Merge branch '44296-commit-path' into 'master'
Resolve "Cannot read property 'commit_path' of null"
Closes #44296
See merge request gitlab-org/gitlab-ce!18231
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js b/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js index 431cb7f3913..ea8007d2029 100644 --- a/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js +++ b/spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js @@ -113,6 +113,46 @@ describe('MRWidgetPipeline', () => { }); }); + describe('without commit path', () => { + beforeEach(() => { + const mockCopy = Object.assign({}, mockData); + delete mockCopy.pipeline.commit; + + vm = mountComponent(Component, { + pipeline: mockCopy.pipeline, + hasCi: true, + ciStatus: 'success', + }); + }); + + it('should render pipeline ID', () => { + expect( + vm.$el.querySelector('.pipeline-id').textContent.trim(), + ).toEqual(`#${mockData.pipeline.id}`); + }); + + it('should render pipeline status', () => { + expect( + vm.$el.querySelector('.media-body').textContent.trim(), + ).toContain(mockData.pipeline.details.status.label); + + expect( + vm.$el.querySelector('.js-commit-link'), + ).toBeNull(); + }); + + it('should render pipeline graph', () => { + expect(vm.$el.querySelector('.mr-widget-pipeline-graph')).toBeDefined(); + expect(vm.$el.querySelectorAll('.stage-container').length).toEqual(mockData.pipeline.details.stages.length); + }); + + it('should render coverage information', () => { + expect( + vm.$el.querySelector('.media-body').textContent, + ).toContain(`Coverage ${mockData.pipeline.coverage}`); + }); + }); + describe('without coverage', () => { it('should not render a coverage', () => { const mockCopy = Object.assign({}, mockData); |