summaryrefslogtreecommitdiff
path: root/spec/frontend/vue_merge_request_widget/components/states/mr_widget_not_allowed_spec.js
blob: 42515c597c5584f76894a7479b9a876ce519b5d7 (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
import { shallowMount } from '@vue/test-utils';
import notAllowedComponent from '~/vue_merge_request_widget/components/states/mr_widget_not_allowed.vue';
import StatusIcon from '~/vue_merge_request_widget/components/mr_widget_status_icon.vue';
import BoldText from '~/vue_merge_request_widget/components/bold_text.vue';

describe('MRWidgetNotAllowed', () => {
  let wrapper;

  beforeEach(() => {
    wrapper = shallowMount(notAllowedComponent);
  });

  afterEach(() => {
    wrapper.destroy();
    wrapper = null;
  });

  it('renders success icon', () => {
    expect(wrapper.findComponent(StatusIcon).exists()).toBe(true);
    expect(wrapper.findComponent(StatusIcon).props().status).toBe('success');
  });

  it('renders informative text', () => {
    const message = wrapper.findComponent(BoldText).props('message');
    expect(message).toContain('Ready to be merged automatically.');
    expect(message).toContain(
      'Ask someone with write access to this repository to merge this request',
    );
  });
});