summaryrefslogtreecommitdiff
path: root/spec/javascripts/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js
blob: b02af94d03a748ab2f178366c1e44c2d3ab0a296 (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
import Vue from 'vue';
import ShaMismatch from '~/vue_merge_request_widget/components/states/sha_mismatch.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import removeBreakLine from 'spec/helpers/vue_component_helper';

describe('ShaMismatch', () => {
  let vm;

  beforeEach(() => {
    const Component = Vue.extend(ShaMismatch);
    vm = mountComponent(Component);
  });

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

  it('should render information message', () => {
    expect(vm.$el.querySelector('button').disabled).toEqual(true);

    expect(
      removeBreakLine(vm.$el.textContent).trim(),
    ).toContain('The source branch HEAD has recently changed. Please reload the page and review the changes before merging');
  });
});