Commit 9b029853 authored by pburdette's avatar pburdette

Fix downstream counter badge link

Ensure the counter badge links to
the pipeline path by passing the
prop.

Changelog: fixed
EE: true
parent 04a281bc
...@@ -212,6 +212,7 @@ export default { ...@@ -212,6 +212,7 @@ export default {
<linked-pipelines-mini-list <linked-pipelines-mini-list
v-if="item.triggered.length" v-if="item.triggered.length"
:triggered="item.triggered" :triggered="item.triggered"
:pipeline-path="item.path"
data-testid="mini-graph-downstream" data-testid="mini-graph-downstream"
/> />
</div> </div>
......
...@@ -87,6 +87,7 @@ export default { ...@@ -87,6 +87,7 @@ export default {
<linked-pipelines-mini-list <linked-pipelines-mini-list
v-if="hasDownstream" v-if="hasDownstream"
:triggered="downstreamPipelines" :triggered="downstreamPipelines"
:pipeline-path="pipeline.path"
data-testid="commit-box-mini-graph-downstream" data-testid="commit-box-mini-graph-downstream"
/> />
</div> </div>
......
query getLinkedPipelines($fullPath: ID!, $iid: ID!) { query getLinkedPipelines($fullPath: ID!, $iid: ID!) {
project(fullPath: $fullPath) { project(fullPath: $fullPath) {
pipeline(iid: $iid) { pipeline(iid: $iid) {
path
downstream { downstream {
nodes { nodes {
id id
......
...@@ -81,6 +81,16 @@ describe('Commit box pipeline mini graph', () => { ...@@ -81,6 +81,16 @@ describe('Commit box pipeline mini graph', () => {
expect(findMiniGraph().exists()).toBe(true); expect(findMiniGraph().exists()).toBe(true);
}); });
it('should pass the pipeline path prop for the counter badge', async () => {
createComponent(downstreamHandler);
await waitForPromises();
const expectedPath = mockDownstreamQueryResponse.data.project.pipeline.path;
expect(findDownstream().props('pipelinePath')).toBe(expectedPath);
});
describe.each` describe.each`
handler | downstreamRenders | upstreamRenders handler | downstreamRenders | upstreamRenders
${downstreamHandler} | ${true} | ${false} ${downstreamHandler} | ${true} | ${false}
......
...@@ -2,6 +2,7 @@ export const mockDownstreamQueryResponse = { ...@@ -2,6 +2,7 @@ export const mockDownstreamQueryResponse = {
data: { data: {
project: { project: {
pipeline: { pipeline: {
path: '/root/ci-project/-/pipelines/790',
downstream: { downstream: {
nodes: [ nodes: [
{ {
...@@ -30,6 +31,7 @@ export const mockUpstreamQueryResponse = { ...@@ -30,6 +31,7 @@ export const mockUpstreamQueryResponse = {
data: { data: {
project: { project: {
pipeline: { pipeline: {
path: '/root/ci-project/-/pipelines/790',
downstream: { downstream: {
nodes: [], nodes: [],
__typename: 'PipelineConnection', __typename: 'PipelineConnection',
...@@ -56,6 +58,7 @@ export const mockUpstreamDownstreamQueryResponse = { ...@@ -56,6 +58,7 @@ export const mockUpstreamDownstreamQueryResponse = {
data: { data: {
project: { project: {
pipeline: { pipeline: {
path: '/root/ci-project/-/pipelines/790',
downstream: { downstream: {
nodes: [ nodes: [
{ {
......
...@@ -77,6 +77,10 @@ describe('Pipelines Table', () => { ...@@ -77,6 +77,10 @@ describe('Pipelines Table', () => {
createComponent({ pipelines: [pipeline] }); createComponent({ pipelines: [pipeline] });
}); });
it('should pass the pipeline path prop for the counter badge', () => {
expect(findDownstream().props('pipelinePath')).toBe(pipeline.path);
});
it('should render only a downstream pipeline', () => { it('should render only a downstream pipeline', () => {
expect(findDownstream().exists()).toBe(true); expect(findDownstream().exists()).toBe(true);
expect(findUpstream().exists()).toBe(false); expect(findUpstream().exists()).toBe(false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment