diff options
Diffstat (limited to 'spec/javascripts/pipelines/graph/linked_pipelines_column_spec.js')
-rw-r--r-- | spec/javascripts/pipelines/graph/linked_pipelines_column_spec.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/javascripts/pipelines/graph/linked_pipelines_column_spec.js b/spec/javascripts/pipelines/graph/linked_pipelines_column_spec.js new file mode 100644 index 00000000000..1f835dc4dee --- /dev/null +++ b/spec/javascripts/pipelines/graph/linked_pipelines_column_spec.js @@ -0,0 +1,38 @@ +import Vue from 'vue'; +import LinkedPipelinesColumn from '~/pipelines/components/graph/linked_pipelines_column.vue'; +import mountComponent from 'spec/helpers/vue_mount_component_helper'; +import mockData from './linked_pipelines_mock_data'; + +describe('Linked Pipelines Column', () => { + const Component = Vue.extend(LinkedPipelinesColumn); + const props = { + columnTitle: 'Upstream', + linkedPipelines: mockData.triggered, + graphPosition: 'right', + }; + let vm; + + beforeEach(() => { + vm = mountComponent(Component, props); + }); + + afterEach(() => { + vm.$destroy(); + }); + + it('renders the pipeline orientation', () => { + const titleElement = vm.$el.querySelector('.linked-pipelines-column-title'); + + expect(titleElement.innerText).toContain(props.columnTitle); + }); + + it('has the correct number of linked pipeline child components', () => { + expect(vm.$children.length).toBe(props.linkedPipelines.length); + }); + + it('renders the correct number of linked pipelines', () => { + const linkedPipelineElements = vm.$el.querySelectorAll('.linked-pipeline'); + + expect(linkedPipelineElements.length).toBe(props.linkedPipelines.length); + }); +}); |