Commit 29e0f3bc authored by Jackie Fraser's avatar Jackie Fraser

Apply review feedback

parent 89d11eb6
import { mount, shallowMount, createLocalVue } from '@vue/test-utils'; import { mount, shallowMount } from '@vue/test-utils';
import MergeTrainPositionIndicator from 'ee/vue_merge_request_widget/components/merge_train_position_indicator.vue'; import MergeTrainPositionIndicator from 'ee/vue_merge_request_widget/components/merge_train_position_indicator.vue';
import VisualReviewAppLink from 'ee/vue_merge_request_widget/components/visual_review_app_link.vue'; import VisualReviewAppLink from 'ee/vue_merge_request_widget/components/visual_review_app_link.vue';
import { mockStore } from 'jest/vue_mr_widget/mock_data'; import { mockStore } from 'jest/vue_mr_widget/mock_data';
...@@ -11,23 +11,27 @@ describe('MrWidgetPipelineContainer', () => { ...@@ -11,23 +11,27 @@ describe('MrWidgetPipelineContainer', () => {
let wrapper; let wrapper;
let mock; let mock;
const factory = (method = shallowMount, mrUpdates = {}, provide = {}) => { beforeEach(() => {
const localVue = createLocalVue(); mock = new MockAdapter(axios);
mock.onGet().reply(200, {});
});
wrapper = method.call(this, localVue.extend(MrWidgetPipelineContainer), { const factory = (method = shallowMount, mrUpdates = {}, provide = {}) => {
wrapper = method.call(this, MrWidgetPipelineContainer, {
propsData: { propsData: {
mr: Object.assign({}, mockStore, mrUpdates), mr: Object.assign({}, mockStore, mrUpdates),
}, },
provide: { provide: {
...provide, ...provide,
}, },
localVue,
attachToDocument: true, attachToDocument: true,
}); });
}; };
afterEach(() => { afterEach(() => {
mock.restore();
wrapper.destroy(); wrapper.destroy();
wrapper = null;
}); });
describe('merge train indicator', () => { describe('merge train indicator', () => {
...@@ -61,9 +65,6 @@ describe('MrWidgetPipelineContainer', () => { ...@@ -61,9 +65,6 @@ describe('MrWidgetPipelineContainer', () => {
describe('with anonymous visual review feedback feature flag enabled', () => { describe('with anonymous visual review feedback feature flag enabled', () => {
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios);
mock.onGet().reply(200, {});
factory( factory(
mount, mount,
{ {
...@@ -101,9 +102,6 @@ describe('MrWidgetPipelineContainer', () => { ...@@ -101,9 +102,6 @@ describe('MrWidgetPipelineContainer', () => {
describe('with anonymous visual review feedback feature flag disabled', () => { describe('with anonymous visual review feedback feature flag disabled', () => {
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios);
mock.onGet().reply(200, {});
factory( factory(
mount, mount,
{ {
......
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