Commit f916ad02 authored by Phil Hughes's avatar Phil Hughes

fixed IDE router push not being spied on

parent 2ca941b5
...@@ -2,6 +2,7 @@ import Vue from 'vue'; ...@@ -2,6 +2,7 @@ import Vue from 'vue';
import store from 'ee/ide/stores'; import store from 'ee/ide/stores';
import service from 'ee/ide/services'; import service from 'ee/ide/services';
import modal from 'ee/ide/components/new_dropdown/modal.vue'; import modal from 'ee/ide/components/new_dropdown/modal.vue';
import router from 'ee/ide/ide_router';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { file, resetStore } from '../../helpers'; import { file, resetStore } from '../../helpers';
...@@ -38,6 +39,8 @@ describe('new file modal component', () => { ...@@ -38,6 +39,8 @@ describe('new file modal component', () => {
submodules: [{ name: 'submodule' }], submodules: [{ name: 'submodule' }],
}), }),
})); }));
spyOn(router, 'push');
}); });
afterEach(() => { afterEach(() => {
......
...@@ -2,6 +2,7 @@ import Vue from 'vue'; ...@@ -2,6 +2,7 @@ import Vue from 'vue';
import upload from 'ee/ide/components/new_dropdown/upload.vue'; import upload from 'ee/ide/components/new_dropdown/upload.vue';
import store from 'ee/ide/stores'; import store from 'ee/ide/stores';
import service from 'ee/ide/services'; import service from 'ee/ide/services';
import router from 'ee/ide/ide_router';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { resetStore } from '../../helpers'; import { resetStore } from '../../helpers';
...@@ -38,6 +39,8 @@ describe('new dropdown upload', () => { ...@@ -38,6 +39,8 @@ describe('new dropdown upload', () => {
}), }),
})); }));
spyOn(router, 'push');
const Component = Vue.extend(upload); const Component = Vue.extend(upload);
store.state.projects.abcproject = { store.state.projects.abcproject = {
......
import Vue from 'vue'; import Vue from 'vue';
import store from 'ee/ide/stores'; import store from 'ee/ide/stores';
import repoTab from 'ee/ide/components/repo_tab.vue'; import repoTab from 'ee/ide/components/repo_tab.vue';
import router from 'ee/ide/ide_router';
import { file, resetStore } from '../helpers'; import { file, resetStore } from '../helpers';
describe('RepoTab', () => { describe('RepoTab', () => {
...@@ -15,6 +16,10 @@ describe('RepoTab', () => { ...@@ -15,6 +16,10 @@ describe('RepoTab', () => {
}).$mount(); }).$mount();
} }
beforeEach(() => {
spyOn(router, 'push');
});
afterEach(() => { afterEach(() => {
resetStore(vm.$store); resetStore(vm.$store);
}); });
......
import Vue from 'vue'; import Vue from 'vue';
import store from 'ee/ide/stores'; import store from 'ee/ide/stores';
import service from 'ee/ide/services'; import service from 'ee/ide/services';
import router from 'ee/ide/ide_router';
import { file, resetStore } from '../../helpers'; import { file, resetStore } from '../../helpers';
describe('Multi-file store file actions', () => { describe('Multi-file store file actions', () => {
beforeEach(() => {
spyOn(router, 'push');
});
afterEach(() => { afterEach(() => {
resetStore(store); resetStore(store);
}); });
......
import Vue from 'vue'; import Vue from 'vue';
import store from 'ee/ide/stores'; import store from 'ee/ide/stores';
import service from 'ee/ide/services'; import service from 'ee/ide/services';
import router from 'ee/ide/ide_router';
import { file, resetStore } from '../../helpers'; import { file, resetStore } from '../../helpers';
describe('Multi-file store tree actions', () => { describe('Multi-file store tree actions', () => {
...@@ -13,6 +14,8 @@ describe('Multi-file store tree actions', () => { ...@@ -13,6 +14,8 @@ describe('Multi-file store tree actions', () => {
}; };
beforeEach(() => { beforeEach(() => {
spyOn(router, 'push');
store.state.currentProjectId = 'abcproject'; store.state.currentProjectId = 'abcproject';
store.state.currentBranchId = 'master'; store.state.currentBranchId = 'master';
store.state.projects.abcproject = { store.state.projects.abcproject = {
......
import Vue from 'vue'; import Vue from 'vue';
import * as urlUtils from '~/lib/utils/url_utility'; import * as urlUtils from '~/lib/utils/url_utility';
import store from 'ee/ide/stores'; import store from 'ee/ide/stores';
import router from 'ee/ide/ide_router';
import { resetStore, file } from '../helpers'; import { resetStore, file } from '../helpers';
describe('Multi-file store actions', () => { describe('Multi-file store actions', () => {
beforeEach(() => {
spyOn(router, 'push');
});
afterEach(() => { afterEach(() => {
resetStore(store); resetStore(store);
}); });
......
...@@ -7,6 +7,10 @@ import * as consts from 'ee/ide/stores/modules/commit/constants'; ...@@ -7,6 +7,10 @@ import * as consts from 'ee/ide/stores/modules/commit/constants';
import { resetStore, file } from 'spec/ide/helpers'; import { resetStore, file } from 'spec/ide/helpers';
describe('IDE commit module actions', () => { describe('IDE commit module actions', () => {
beforeEach(() => {
spyOn(router, 'push');
});
afterEach(() => { afterEach(() => {
resetStore(store); resetStore(store);
}); });
...@@ -170,7 +174,6 @@ describe('IDE commit module actions', () => { ...@@ -170,7 +174,6 @@ describe('IDE commit module actions', () => {
beforeEach(() => { beforeEach(() => {
spyOn(eventHub, '$emit'); spyOn(eventHub, '$emit');
spyOn(router, 'push');
f = file('changedFile'); f = file('changedFile');
Object.assign(f, { Object.assign(f, {
...@@ -287,7 +290,7 @@ describe('IDE commit module actions', () => { ...@@ -287,7 +290,7 @@ describe('IDE commit module actions', () => {
describe('commitChanges', () => { describe('commitChanges', () => {
beforeEach(() => { beforeEach(() => {
spyOn(router, 'push'); spyOn(urlUtils, 'visitUrl');
document.body.innerHTML += '<div class="flash-container"></div>'; document.body.innerHTML += '<div class="flash-container"></div>';
...@@ -380,8 +383,6 @@ describe('IDE commit module actions', () => { ...@@ -380,8 +383,6 @@ describe('IDE commit module actions', () => {
}); });
it('redirects to new merge request page', (done) => { it('redirects to new merge request page', (done) => {
spyOn(urlUtils, 'visitUrl');
store.state.commit.commitAction = '3'; store.state.commit.commitAction = '3';
store.dispatch('commit/commitChanges') store.dispatch('commit/commitChanges')
......
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