Commit e2e18064 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch 'jdb/remove-vue-instance-mod-diff-file-spec' into 'master'

Remove direct mod of Vue instance

See merge request gitlab-org/gitlab!50629
parents aea738df 9f5cf35e
import Vuex from 'vuex'; import Vuex from 'vuex';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import httpStatus from '~/lib/utils/http_status';
import createDiffsStore from '~/diffs/store/modules'; import createDiffsStore from '~/diffs/store/modules';
import createNotesStore from '~/notes/stores/modules'; import createNotesStore from '~/notes/stores/modules';
import diffFileMockDataReadable from '../mock_data/diff_file'; import diffFileMockDataReadable from '../mock_data/diff_file';
...@@ -118,14 +121,17 @@ const changeViewerType = (store, newType, index = 0) => ...@@ -118,14 +121,17 @@ const changeViewerType = (store, newType, index = 0) =>
describe('DiffFile', () => { describe('DiffFile', () => {
let wrapper; let wrapper;
let store; let store;
let axiosMock;
beforeEach(() => { beforeEach(() => {
axiosMock = new MockAdapter(axios);
({ wrapper, store } = createComponent({ file: getReadableFile() })); ({ wrapper, store } = createComponent({ file: getReadableFile() }));
}); });
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
wrapper = null; wrapper = null;
axiosMock.restore();
}); });
describe('bus events', () => { describe('bus events', () => {
...@@ -353,8 +359,10 @@ describe('DiffFile', () => { ...@@ -353,8 +359,10 @@ describe('DiffFile', () => {
describe('loading', () => { describe('loading', () => {
it('should have loading icon while loading a collapsed diffs', async () => { it('should have loading icon while loading a collapsed diffs', async () => {
const { load_collapsed_diff_url } = store.state.diffs.diffFiles[0];
axiosMock.onGet(load_collapsed_diff_url).reply(httpStatus.OK, getReadableFile());
makeFileAutomaticallyCollapsed(store); makeFileAutomaticallyCollapsed(store);
wrapper.vm.isLoadingCollapsedDiff = true; wrapper.vm.requestDiff();
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
......
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