BigW Consortium Gitlab

empty_state_spec.js 1.51 KB
Newer Older
1
import Vue from 'vue';
2
import emptyStateComp from '~/pipelines/components/empty_state.vue';
3
import mountComponent from '../helpers/vue_mount_component_helper';
4 5 6 7 8 9 10 11

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

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

12 13 14 15 16 17 18 19 20
    component = mountComponent(EmptyStateComponent, {
      helpPagePath: 'foo',
      emptyStateSvgPath: 'foo',
      canSetCi: true,
    });
  });

  afterEach(() => {
    component.$destroy();
21 22 23 24 25 26 27 28 29 30
  });

  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(
31 32
      component.$el.querySelector('p').innerHTML.trim().replace(/\n+\s+/m, ' ').replace(/\s\s+/g, ' '),
    ).toContain('Continous Integration can help catch bugs by running your tests automatically,');
33 34

    expect(
35 36
      component.$el.querySelector('p').innerHTML.trim().replace(/\n+\s+/m, ' ').replace(/\s\s+/g, ' '),
    ).toContain('while Continuous Deployment can help you deliver code to your product environment');
37 38 39
  });

  it('should render a link with provided help path', () => {
40 41
    expect(component.$el.querySelector('.js-get-started-pipelines').getAttribute('href')).toEqual('foo');
    expect(component.$el.querySelector('.js-get-started-pipelines').textContent).toContain('Get started with Pipelines');
42 43
  });
});