Commit 0b472c2d authored by Phil Hughes's avatar Phil Hughes

Merge branch '6580-mr-widget-pipeline-spec' into 'master'

Moves EE specific tests into EE file for mr_widget_pipeline_spec

Closes #6580

See merge request gitlab-org/gitlab-ee!9958
parents 4180c536 410f0587
import Vue from 'vue';
import pipelineComponent from '~/vue_merge_request_widget/components/mr_widget_pipeline.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import mockData from 'spec/vue_mr_widget/mock_data';
import mockLinkedPipelines from 'ee_spec/pipelines/graph/linked_pipelines_mock_data';
describe('MRWidgetPipeline', () => {
let vm;
let Component;
beforeEach(() => {
Component = Vue.extend(pipelineComponent);
});
afterEach(() => {
vm.$destroy();
});
describe('computed', () => {
describe('when upstream pipelines are passed', () => {
beforeEach(() => {
vm = mountComponent(Component, {
pipeline: Object.assign({}, mockData.pipeline, {
triggered_by: mockLinkedPipelines.triggered_by,
}),
hasCi: true,
ciStatus: 'success',
troubleshootingDocsPath: 'help',
});
});
it('should coerce triggeredBy into a collection', () => {
expect(vm.triggeredBy.length).toBe(1);
});
it('should render the linked pipelines mini list', () => {
expect(vm.$el.querySelector('.linked-pipeline-mini-list.is-upstream')).not.toBeNull();
});
});
describe('when downstream pipelines are passed', () => {
beforeEach(() => {
vm = mountComponent(Component, {
pipeline: Object.assign({}, mockData.pipeline, {
triggered: mockLinkedPipelines.triggered,
}),
hasCi: true,
ciStatus: 'success',
troubleshootingDocsPath: 'help',
});
});
it('should render the linked pipelines mini list', () => {
expect(vm.$el.querySelector('.linked-pipeline-mini-list.is-downstream')).not.toBeNull();
});
});
});
});
......@@ -2,7 +2,6 @@ import Vue from 'vue';
import pipelineComponent from '~/vue_merge_request_widget/components/mr_widget_pipeline.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import mockData from '../mock_data';
import mockLinkedPipelines from 'ee_spec/pipelines/graph/linked_pipelines_mock_data'; // eslint-disable-line import/order
describe('MRWidgetPipeline', () => {
let vm;
......@@ -194,43 +193,5 @@ describe('MRWidgetPipeline', () => {
expect(vm.$el.querySelector('.js-mini-pipeline-graph')).toEqual(null);
});
});
describe('when upstream pipelines are passed', () => {
beforeEach(() => {
vm = mountComponent(Component, {
pipeline: Object.assign({}, mockData.pipeline, {
triggered_by: mockLinkedPipelines.triggered_by,
}),
hasCi: true,
ciStatus: 'success',
troubleshootingDocsPath: 'help',
});
});
it('should coerce triggeredBy into a collection', () => {
expect(vm.triggeredBy.length).toBe(1);
});
it('should render the linked pipelines mini list', () => {
expect(vm.$el.querySelector('.linked-pipeline-mini-list.is-upstream')).not.toBeNull();
});
});
describe('when downstream pipelines are passed', () => {
beforeEach(() => {
vm = mountComponent(Component, {
pipeline: Object.assign({}, mockData.pipeline, {
triggered: mockLinkedPipelines.triggered,
}),
hasCi: true,
ciStatus: 'success',
troubleshootingDocsPath: 'help',
});
});
it('should render the linked pipelines mini list', () => {
expect(vm.$el.querySelector('.linked-pipeline-mini-list.is-downstream')).not.toBeNull();
});
});
});
});
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