summaryrefslogtreecommitdiff
path: root/spec/frontend/pipelines/pipeline_url_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/pipelines/pipeline_url_spec.js')
-rw-r--r--spec/frontend/pipelines/pipeline_url_spec.js29
1 files changed, 24 insertions, 5 deletions
diff --git a/spec/frontend/pipelines/pipeline_url_spec.js b/spec/frontend/pipelines/pipeline_url_spec.js
index 44c9def99cc..4997e9cf3ec 100644
--- a/spec/frontend/pipelines/pipeline_url_spec.js
+++ b/spec/frontend/pipelines/pipeline_url_spec.js
@@ -1,9 +1,8 @@
import { shallowMount } from '@vue/test-utils';
-import $ from 'jquery';
import { trimText } from 'helpers/text_helper';
import PipelineUrlComponent from '~/pipelines/components/pipelines_list/pipeline_url.vue';
-$.fn.popover = () => {};
+const projectPath = 'test/test';
describe('Pipeline Url Component', () => {
let wrapper;
@@ -14,6 +13,7 @@ describe('Pipeline Url Component', () => {
const findYamlTag = () => wrapper.find('[data-testid="pipeline-url-yaml"]');
const findFailureTag = () => wrapper.find('[data-testid="pipeline-url-failure"]');
const findAutoDevopsTag = () => wrapper.find('[data-testid="pipeline-url-autodevops"]');
+ const findAutoDevopsTagLink = () => wrapper.find('[data-testid="pipeline-url-autodevops-link"]');
const findStuckTag = () => wrapper.find('[data-testid="pipeline-url-stuck"]');
const findDetachedTag = () => wrapper.find('[data-testid="pipeline-url-detached"]');
const findForkTag = () => wrapper.find('[data-testid="pipeline-url-fork"]');
@@ -23,9 +23,9 @@ describe('Pipeline Url Component', () => {
pipeline: {
id: 1,
path: 'foo',
+ project: { full_path: `/${projectPath}` },
flags: {},
},
- autoDevopsHelpPath: 'foo',
pipelineScheduleUrl: 'foo',
};
@@ -33,7 +33,7 @@ describe('Pipeline Url Component', () => {
wrapper = shallowMount(PipelineUrlComponent, {
propsData: { ...defaultProps, ...props },
provide: {
- targetProjectFullPath: 'test/test',
+ targetProjectFullPath: projectPath,
},
});
};
@@ -57,6 +57,19 @@ describe('Pipeline Url Component', () => {
expect(findPipelineUrlLink().text()).toBe('#1');
});
+ it('should not render tags when flags are not set', () => {
+ createComponent();
+
+ expect(findStuckTag().exists()).toBe(false);
+ expect(findLatestTag().exists()).toBe(false);
+ expect(findYamlTag().exists()).toBe(false);
+ expect(findAutoDevopsTag().exists()).toBe(false);
+ expect(findFailureTag().exists()).toBe(false);
+ expect(findScheduledTag().exists()).toBe(false);
+ expect(findForkTag().exists()).toBe(false);
+ expect(findTrainTag().exists()).toBe(false);
+ });
+
it('should render the stuck tag when flag is provided', () => {
createComponent({
pipeline: {
@@ -96,6 +109,7 @@ describe('Pipeline Url Component', () => {
it('should render an autodevops badge when flag is provided', () => {
createComponent({
pipeline: {
+ ...defaultProps.pipeline,
flags: {
auto_devops: true,
},
@@ -103,6 +117,11 @@ describe('Pipeline Url Component', () => {
});
expect(trimText(findAutoDevopsTag().text())).toBe('Auto DevOps');
+
+ expect(findAutoDevopsTagLink().attributes()).toMatchObject({
+ href: '/help/topics/autodevops/index.md',
+ target: '_blank',
+ });
});
it('should render a detached badge when flag is provided', () => {
@@ -147,7 +166,7 @@ describe('Pipeline Url Component', () => {
createComponent({
pipeline: {
flags: {},
- project: { fullPath: 'test/forked' },
+ project: { fullPath: '/test/forked' },
},
});