Commit c152931c authored by Scott Hampton's avatar Scott Hampton

Merge branch 'vs-migrate-mr-widget-merging-spec-to-vtu' into 'master'

Migrate mr_widget_merging to VTU

See merge request gitlab-org/gitlab!56504
parents 1589d640 e03472d0
import Vue from 'vue'; import { shallowMount } from '@vue/test-utils';
import mountComponent from 'helpers/vue_mount_component_helper'; import MrWidgetMerging from '~/vue_merge_request_widget/components/states/mr_widget_merging.vue';
import mergingComponent from '~/vue_merge_request_widget/components/states/mr_widget_merging.vue';
describe('MRWidgetMerging', () => { describe('MRWidgetMerging', () => {
let vm; let wrapper;
beforeEach(() => {
const Component = Vue.extend(mergingComponent);
vm = mountComponent(Component, { beforeEach(() => {
wrapper = shallowMount(MrWidgetMerging, {
propsData: {
mr: { mr: {
targetBranchPath: '/branch-path', targetBranchPath: '/branch-path',
targetBranch: 'branch', targetBranch: 'branch',
}, },
},
}); });
}); });
afterEach(() => { afterEach(() => {
vm.$destroy(); wrapper.destroy();
}); });
it('renders information about merge request being merged', () => { it('renders information about merge request being merged', () => {
expect( expect(
vm.$el wrapper
.querySelector('.media-body') .find('.media-body')
.textContent.trim() .text()
.trim()
.replace(/\s\s+/g, ' ') .replace(/\s\s+/g, ' ')
.replace(/[\r\n]+/g, ' '), .replace(/[\r\n]+/g, ' '),
).toContain('This merge request is in the process of being merged'); ).toContain('This merge request is in the process of being merged');
...@@ -31,13 +32,14 @@ describe('MRWidgetMerging', () => { ...@@ -31,13 +32,14 @@ describe('MRWidgetMerging', () => {
it('renders branch information', () => { it('renders branch information', () => {
expect( expect(
vm.$el wrapper
.querySelector('.mr-info-list') .find('.mr-info-list')
.textContent.trim() .text()
.trim()
.replace(/\s\s+/g, ' ') .replace(/\s\s+/g, ' ')
.replace(/[\r\n]+/g, ' '), .replace(/[\r\n]+/g, ' '),
).toEqual('The changes will be merged into branch'); ).toEqual('The changes will be merged into branch');
expect(vm.$el.querySelector('a').getAttribute('href')).toEqual('/branch-path'); expect(wrapper.find('a').attributes('href')).toBe('/branch-path');
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment