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 mountComponent from 'helpers/vue_mount_component_helper';
import mergingComponent from '~/vue_merge_request_widget/components/states/mr_widget_merging.vue';
import { shallowMount } from '@vue/test-utils';
import MrWidgetMerging from '~/vue_merge_request_widget/components/states/mr_widget_merging.vue';
describe('MRWidgetMerging', () => {
let vm;
beforeEach(() => {
const Component = Vue.extend(mergingComponent);
let wrapper;
vm = mountComponent(Component, {
beforeEach(() => {
wrapper = shallowMount(MrWidgetMerging, {
propsData: {
mr: {
targetBranchPath: '/branch-path',
targetBranch: 'branch',
},
},
});
});
afterEach(() => {
vm.$destroy();
wrapper.destroy();
});
it('renders information about merge request being merged', () => {
expect(
vm.$el
.querySelector('.media-body')
.textContent.trim()
wrapper
.find('.media-body')
.text()
.trim()
.replace(/\s\s+/g, ' ')
.replace(/[\r\n]+/g, ' '),
).toContain('This merge request is in the process of being merged');
......@@ -31,13 +32,14 @@ describe('MRWidgetMerging', () => {
it('renders branch information', () => {
expect(
vm.$el
.querySelector('.mr-info-list')
.textContent.trim()
wrapper
.find('.mr-info-list')
.text()
.trim()
.replace(/\s\s+/g, ' ')
.replace(/[\r\n]+/g, ' '),
).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