Commit 1ead1684 authored by Phil Hughes's avatar Phil Hughes

Fixed failing Jest specs

This was caused by a Vuex store getting setup when it didn't
need to be setup.
parent 46c67eb7
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import store from './store'; import createStore from './store';
import App from './components/app.vue'; import App from './components/app.vue';
Vue.use(Vuex);
export default initialData => { export default initialData => {
const el = document.getElementById('js-code-navigation'); const el = document.getElementById('js-code-navigation');
if (!el) return null;
Vue.use(Vuex);
const store = createStore();
store.dispatch('setInitialData', initialData); store.dispatch('setInitialData', initialData);
return new Vue({ return new Vue({
......
...@@ -3,8 +3,9 @@ import createState from './state'; ...@@ -3,8 +3,9 @@ import createState from './state';
import actions from './actions'; import actions from './actions';
import mutations from './mutations'; import mutations from './mutations';
export default new Vuex.Store({ export default () =>
actions, new Vuex.Store({
mutations, actions,
state: createState(), mutations,
}); state: createState(),
});
...@@ -103,18 +103,20 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { ...@@ -103,18 +103,20 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => {
commit(types.VIEW_DIFF_FILE, state.diffFiles[0].file_hash); commit(types.VIEW_DIFF_FILE, state.diffFiles[0].file_hash);
} }
// eslint-disable-next-line promise/catch-or-return,promise/no-nesting if (state.diffFiles?.length) {
import('~/code_navigation').then(m => // eslint-disable-next-line promise/catch-or-return,promise/no-nesting
m.default({ import('~/code_navigation').then(m =>
blobs: state.diffFiles m.default({
.filter(f => f.code_navigation_path) blobs: state.diffFiles
.map(f => ({ .filter(f => f.code_navigation_path)
path: f.new_path, .map(f => ({
codeNavigationPath: f.code_navigation_path, path: f.new_path,
})), codeNavigationPath: f.code_navigation_path,
definitionPathPrefix: state.definitionPathPrefix, })),
}), definitionPathPrefix: state.definitionPathPrefix,
); }),
);
}
} }
return pagination.next_page; return pagination.next_page;
......
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