Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mr_widget_missing_branch_spec.js « states « components « vue_merge_request_widget « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f29cf55f7ce8ab47a293649b6c88783318b89ef7 (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 { shallowMount } from '@vue/test-utils';
import MissingBranchComponent from '~/vue_merge_request_widget/components/states/mr_widget_missing_branch.vue';

let wrapper;

function factory(sourceBranchRemoved) {
  wrapper = shallowMount(MissingBranchComponent, {
    propsData: {
      mr: { sourceBranchRemoved },
    },
    data() {
      return { state: { sourceBranchExists: !sourceBranchRemoved } };
    },
  });
}

describe('MRWidgetMissingBranch', () => {
  afterEach(() => {
    wrapper.destroy();
  });

  it.each`
    sourceBranchRemoved | branchName
    ${true}             | ${'source'}
    ${false}            | ${'target'}
  `(
    'should set missing branch name as $branchName when sourceBranchRemoved is $sourceBranchRemoved',
    ({ sourceBranchRemoved, branchName }) => {
      factory(sourceBranchRemoved);

      expect(wrapper.find('[data-testid="widget-content"]').text()).toContain(branchName);
    },
  );
});