Welcome to mirror list, hosted at ThFree Co, Russian Federation.

linked_pipelines_column_spec.js « graph « pipelines « javascripts « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 613ab2a906fae8f44e68c65a1e3227a4fcaa736c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import Vue from 'vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import LinkedPipelinesColumn from '~/pipelines/components/graph/linked_pipelines_column.vue';
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',
    projectId: 19,
  };
  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);
  });

  it('renders cross project triangle when column is upstream', () => {
    expect(vm.$el.querySelector('.cross-project-triangle')).toBeDefined();
  });
});