summaryrefslogtreecommitdiff
path: root/spec/javascripts/vue_mr_widget/components/states/mr_widget_merging_spec.js
blob: 0b2ed2d408657947862c97859ae5d3051f9aff76 (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
import Vue from 'vue';
import mergingComponent from '~/vue_merge_request_widget/components/states/mr_widget_merging.vue';
import mountComponent from '../../../helpers/vue_mount_component_helper';

describe('MRWidgetMerging', () => {
  let vm;
  beforeEach(() => {
    const Component = Vue.extend(mergingComponent);

    vm = mountComponent(Component, { mr: {
      targetBranchPath: '/branch-path',
      targetBranch: 'branch',
    } });
  });

  afterEach(() => {
    vm.$destroy();
  });

  it('renders information about merge request being merged', () => {
    expect(
      vm.$el.querySelector('.media-body').textContent.trim().replace(/\s\s+/g, ' ').replace(/[\r\n]+/g, ' '),
    ).toContain('This merge request is in the process of being merged');
  });

  it('renders branch information', () => {
    expect(
      vm.$el.querySelector('.mr-info-list').textContent.trim().replace(/\s\s+/g, ' ').replace(/[\r\n]+/g, ' '),
    ).toEqual('The changes will be merged into branch');
    expect(
      vm.$el.querySelector('a').getAttribute('href'),
    ).toEqual('/branch-path');
  });
});