summaryrefslogtreecommitdiff
path: root/spec/javascripts/pipelines/graph/stage_column_component_spec.js
blob: aa4d6eedaf422db1efa94a6e3f5aea03da2b2164 (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
import Vue from 'vue';
import stageColumnComponent from '~/pipelines/components/graph/stage_column_component.vue';

describe('stage column component', () => {
  let component;
  const mockJob = {
    id: 4256,
    name: 'test',
    status: {
      icon: 'icon_status_success',
      text: 'passed',
      label: 'passed',
      group: 'success',
      details_path: '/root/ci-mock/builds/4256',
      action: {
        icon: 'icon_action_retry',
        title: 'Retry',
        path: '/root/ci-mock/builds/4256/retry',
        method: 'post',
      },
    },
  };

  beforeEach(() => {
    const StageColumnComponent = Vue.extend(stageColumnComponent);

    component = new StageColumnComponent({
      propsData: {
        title: 'foo',
        jobs: [mockJob, mockJob, mockJob],
      },
    }).$mount();
  });

  it('should render provided title', () => {
    expect(component.$el.querySelector('.stage-name').textContent.trim()).toEqual('foo');
  });

  it('should render the provided jobs', () => {
    expect(component.$el.querySelectorAll('.builds-container > ul > li').length).toEqual(3);
  });
});