summaryrefslogtreecommitdiff
path: root/spec/javascripts/pipelines/empty_state_spec.js
blob: 97f04844b3a0291bf860119acd81000313a9286d (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
import Vue from 'vue';
import emptyStateComp from '~/pipelines/components/empty_state.vue';

describe('Pipelines Empty State', () => {
  let component;
  let EmptyStateComponent;

  beforeEach(() => {
    EmptyStateComponent = Vue.extend(emptyStateComp);

    component = new EmptyStateComponent({
      propsData: {
        helpPagePath: 'foo',
        emptyStateSvgPath: 'foo',
      },
    }).$mount();
  });

  it('should render empty state SVG', () => {
    expect(component.$el.querySelector('.svg-content svg')).toBeDefined();
  });

  it('should render emtpy state information', () => {
    expect(component.$el.querySelector('h4').textContent).toContain('Build with confidence');

    expect(
      component.$el.querySelector('p').textContent.trim().replace(/[\r\n]+/g, ' '),
    ).toContain('Continous Integration can help catch bugs by running your tests automatically');

    expect(
      component.$el.querySelector('p').textContent.trim().replace(/[\r\n]+/g, ' '),
    ).toContain('Continuous Deployment can help you deliver code to your product environment');
  });

  it('should render a link with provided help path', () => {
    expect(component.$el.querySelector('.btn-info').getAttribute('href')).toEqual('foo');
    expect(component.$el.querySelector('.btn-info').textContent).toContain('Get started with Pipelines');
  });
});