diff options
Diffstat (limited to 'spec/frontend/ci/pipelines_page/components/pipeline_labels_spec.js')
-rw-r--r-- | spec/frontend/ci/pipelines_page/components/pipeline_labels_spec.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/frontend/ci/pipelines_page/components/pipeline_labels_spec.js b/spec/frontend/ci/pipelines_page/components/pipeline_labels_spec.js index b5c9a3030e0..6b0d5b18f7d 100644 --- a/spec/frontend/ci/pipelines_page/components/pipeline_labels_spec.js +++ b/spec/frontend/ci/pipelines_page/components/pipeline_labels_spec.js @@ -15,6 +15,7 @@ describe('Pipeline label component', () => { const findAutoDevopsTag = () => wrapper.findByTestId('pipeline-url-autodevops'); const findAutoDevopsTagLink = () => wrapper.findByTestId('pipeline-url-autodevops-link'); const findDetachedTag = () => wrapper.findByTestId('pipeline-url-detached'); + const findMergedResultsTag = () => wrapper.findByTestId('pipeline-url-merged-results'); const findFailureTag = () => wrapper.findByTestId('pipeline-url-failure'); const findForkTag = () => wrapper.findByTestId('pipeline-url-fork'); const findTrainTag = () => wrapper.findByTestId('pipeline-url-train'); @@ -25,6 +26,7 @@ describe('Pipeline label component', () => { wrapper = shallowMountExtended(PipelineLabelsComponent, { propsData: { ...defaultProps, ...props }, provide: { + pipelineSchedulesPath: 'group/project/-/schedules', targetProjectFullPath: projectPath, }, }); @@ -41,6 +43,7 @@ describe('Pipeline label component', () => { expect(findScheduledTag().exists()).toBe(false); expect(findForkTag().exists()).toBe(false); expect(findTrainTag().exists()).toBe(false); + expect(findMergedResultsTag().exists()).toBe(false); }); it('should render the stuck tag when flag is provided', () => { @@ -140,9 +143,33 @@ describe('Pipeline label component', () => { expect(findForkTag().text()).toBe('fork'); }); + it('should render the merged results badge when the pipeline is a merged results pipeline', () => { + const mergedResultsPipeline = defaultProps.pipeline; + mergedResultsPipeline.flags.merged_result_pipeline = true; + + createComponent({ + ...mergedResultsPipeline, + }); + + expect(findMergedResultsTag().text()).toBe('merged results'); + }); + + it('should not render the merged results badge when the pipeline is not a merged results pipeline', () => { + const mergedResultsPipeline = defaultProps.pipeline; + mergedResultsPipeline.flags.merged_result_pipeline = false; + + createComponent({ + ...mergedResultsPipeline, + }); + + expect(findMergedResultsTag().exists()).toBe(false); + }); + it('should render the train badge when the pipeline is a merge train pipeline', () => { const mergeTrainPipeline = defaultProps.pipeline; mergeTrainPipeline.flags.merge_train_pipeline = true; + // a merge train pipeline is also a merged results pipeline + mergeTrainPipeline.flags.merged_result_pipeline = true; createComponent({ ...mergeTrainPipeline, @@ -161,4 +188,17 @@ describe('Pipeline label component', () => { expect(findTrainTag().exists()).toBe(false); }); + + it('should not render the merged results badge when the pipeline is a merge train pipeline', () => { + const mergeTrainPipeline = defaultProps.pipeline; + mergeTrainPipeline.flags.merge_train_pipeline = true; + // a merge train pipeline is also a merged results pipeline + mergeTrainPipeline.flags.merged_result_pipeline = true; + + createComponent({ + ...mergeTrainPipeline, + }); + + expect(findMergedResultsTag().exists()).toBe(false); + }); }); |