summaryrefslogtreecommitdiff
path: root/spec/javascripts/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js
blob: 6042d7384d581e4141dd5bc78f76d23b38d1538b (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
import Vue from 'vue';
import autoMergeFailedComponent from '~/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed';

const mergeError = 'This is the merge error';

describe('MRWidgetAutoMergeFailed', () => {
  describe('props', () => {
    it('should have props', () => {
      const mrProp = autoMergeFailedComponent.props.mr;

      expect(mrProp.type instanceof Object).toBeTruthy();
      expect(mrProp.required).toBeTruthy();
    });
  });

  describe('template', () => {
    const Component = Vue.extend(autoMergeFailedComponent);
    const vm = new Component({
      el: document.createElement('div'),
      propsData: {
        mr: { mergeError },
      },
    });

    it('should have correct elements', () => {
      expect(vm.$el.classList.contains('mr-widget-body')).toBeTruthy();
      expect(vm.$el.querySelector('button').getAttribute('disabled')).toBeFalsy();
      expect(vm.$el.innerText).toContain('This merge request failed to be merged automatically');
      expect(vm.$el.innerText).toContain(mergeError);
    });
  });
});