diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-15 18:07:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-15 18:07:42 +0300 |
commit | fa7c331b76ed59230cc56fc51bfc9e467c8bb9b4 (patch) | |
tree | eb03d2b6e8dd45f67864635c8b0b0de8d671edf7 /spec/frontend/pipelines | |
parent | f26f31d2fd8e3c91677e2629293b9e0562c1437a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pipelines')
-rw-r--r-- | spec/frontend/pipelines/pipelines_table_spec.js | 8 | ||||
-rw-r--r-- | spec/frontend/pipelines/utils_spec.js | 37 |
2 files changed, 45 insertions, 0 deletions
diff --git a/spec/frontend/pipelines/pipelines_table_spec.js b/spec/frontend/pipelines/pipelines_table_spec.js index 9359bd9b95f..6ec8901038b 100644 --- a/spec/frontend/pipelines/pipelines_table_spec.js +++ b/spec/frontend/pipelines/pipelines_table_spec.js @@ -121,6 +121,14 @@ describe('Pipelines Table', () => { expect(findPipelineMiniGraph().props('stages').length).toBe(stagesLength); }); + it('should render the latest downstream pipelines only', () => { + // component receives two downstream pipelines. one of them is already outdated + // because we retried the trigger job, so the mini pipeline graph will only + // render the newly created downstream pipeline instead + expect(pipeline.triggered).toHaveLength(2); + expect(findPipelineMiniGraph().props('downstreamPipelines')).toHaveLength(1); + }); + describe('when pipeline does not have stages', () => { beforeEach(() => { pipeline = createMockPipeline(); diff --git a/spec/frontend/pipelines/utils_spec.js b/spec/frontend/pipelines/utils_spec.js index 1c23a7e4fcf..51e0e0705ff 100644 --- a/spec/frontend/pipelines/utils_spec.js +++ b/spec/frontend/pipelines/utils_spec.js @@ -3,6 +3,7 @@ import { makeLinksFromNodes, filterByAncestors, generateColumnsFromLayersListBare, + keepLatestDownstreamPipelines, listByLayers, parseData, removeOrphanNodes, @@ -10,6 +11,8 @@ import { } from '~/pipelines/components/parsing_utils'; import { createNodeDict } from '~/pipelines/utils'; +import { mockDownstreamPipelinesRest } from '../vue_merge_request_widget/mock_data'; +import { mockDownstreamPipelinesGraphql } from '../commit/mock_data'; import { mockParsedGraphQLNodes, missingJob } from './components/dag/mock_data'; import { generateResponse, mockPipelineResponse } from './graph/mock_data'; @@ -159,3 +162,37 @@ describe('DAG visualization parsing utilities', () => { }); }); }); + +describe('linked pipeline utilities', () => { + describe('keepLatestDownstreamPipelines', () => { + it('filters data from GraphQL', () => { + const downstream = mockDownstreamPipelinesGraphql().nodes; + const latestDownstream = keepLatestDownstreamPipelines(downstream); + + expect(downstream).toHaveLength(3); + expect(latestDownstream).toHaveLength(1); + }); + + it('filters data from REST', () => { + const downstream = mockDownstreamPipelinesRest(); + const latestDownstream = keepLatestDownstreamPipelines(downstream); + + expect(downstream).toHaveLength(2); + expect(latestDownstream).toHaveLength(1); + }); + + it('returns downstream pipelines if sourceJob.retried is null', () => { + const downstream = mockDownstreamPipelinesGraphql({ includeSourceJobRetried: false }).nodes; + const latestDownstream = keepLatestDownstreamPipelines(downstream); + + expect(latestDownstream).toHaveLength(downstream.length); + }); + + it('returns downstream pipelines if source_job.retried is null', () => { + const downstream = mockDownstreamPipelinesRest({ includeSourceJobRetried: false }); + const latestDownstream = keepLatestDownstreamPipelines(downstream); + + expect(latestDownstream).toHaveLength(downstream.length); + }); + }); +}); |