Commit dd7fd3ae authored by Miguel Rincon's avatar Miguel Rincon

Update pipeline blocked component specs to jest

Updates the "pipeline blocked" component specs to jest to simplify
tests.
parent 6100ba7f
import Vue from 'vue';
import mountComponent from 'helpers/vue_mount_component_helper';
import { removeBreakLine } from 'helpers/text_helper';
import pipelineBlockedComponent from '~/vue_merge_request_widget/components/states/mr_widget_pipeline_blocked.vue';
import { shallowMount, mount } from '@vue/test-utils';
import PipelineBlockedComponent from '~/vue_merge_request_widget/components/states/mr_widget_pipeline_blocked.vue';
describe('MRWidgetPipelineBlocked', () => {
let vm;
beforeEach(() => {
const Component = Vue.extend(pipelineBlockedComponent);
vm = mountComponent(Component);
});
let wrapper;
const createWrapper = (mountFn = shallowMount) => {
wrapper = mountFn(PipelineBlockedComponent);
};
afterEach(() => {
vm.$destroy();
wrapper.destroy();
});
it('renders warning icon', () => {
expect(vm.$el.querySelector('.ci-status-icon-warning')).not.toBe(null);
createWrapper(mount);
expect(wrapper.find('.ci-status-icon-warning').exists()).toBe(true);
});
it('renders information text', () => {
expect(removeBreakLine(vm.$el.textContent).trim()).toContain(
createWrapper();
expect(wrapper.text()).toBe(
'Pipeline blocked. The pipeline for this merge request requires a manual action to proceed',
);
});
......
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