diff options
author | Dennis Tang <dtang@gitlab.com> | 2018-05-23 17:12:07 +0300 |
---|---|---|
committer | Dennis Tang <dtang@gitlab.com> | 2018-05-23 17:12:07 +0300 |
commit | 4e0e0552c674c44d7e6ddd2acb08cd6c1857093c (patch) | |
tree | fc688a08cbf68aca428cdf9dd98ee6e033cc258e /app/assets/javascripts | |
parent | c960fea1814f116bd44c38a7313777fd24733a31 (diff) |
fix tests
each suite needs its own instance of the store, but the state has to be returned via a factory otherwise the suites all share the same reference to one state object
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/projects/gke_cluster_dropdowns/store/index.js | 17 | ||||
-rw-r--r-- | app/assets/javascripts/projects/gke_cluster_dropdowns/store/state.js | 6 |
2 files changed, 14 insertions, 9 deletions
diff --git a/app/assets/javascripts/projects/gke_cluster_dropdowns/store/index.js b/app/assets/javascripts/projects/gke_cluster_dropdowns/store/index.js index 458ca1b3164..10fdfe53094 100644 --- a/app/assets/javascripts/projects/gke_cluster_dropdowns/store/index.js +++ b/app/assets/javascripts/projects/gke_cluster_dropdowns/store/index.js @@ -3,13 +3,16 @@ import Vuex from 'vuex'; import * as actions from './actions'; import * as getters from './getters'; import mutations from './mutations'; -import state from './state'; +import { state } from './state'; Vue.use(Vuex); -export default new Vuex.Store({ - actions, - getters, - mutations, - state, -}); +export const createStore = () => + new Vuex.Store({ + actions, + getters, + mutations, + state: state(), + }); + +export default createStore(); diff --git a/app/assets/javascripts/projects/gke_cluster_dropdowns/store/state.js b/app/assets/javascripts/projects/gke_cluster_dropdowns/store/state.js index 5ed8a8da7b5..fb3ead38215 100644 --- a/app/assets/javascripts/projects/gke_cluster_dropdowns/store/state.js +++ b/app/assets/javascripts/projects/gke_cluster_dropdowns/store/state.js @@ -1,4 +1,4 @@ -export default { +export const state = () => ({ selectedProject: { projectId: '', name: '', @@ -9,4 +9,6 @@ export default { projects: [], zones: [], machineTypes: [], -}; +}); + +export default state(); |