Read about our upcoming Code of Conduct on this issue

Commit 3bf70c92 authored by Phil Hughes's avatar Phil Hughes
Browse files

Merge branch 'winh-vuex-createStore-docs' into 'master'

Make stores export a createStore() which can be used in tests

See merge request gitlab-org/gitlab-ce!19030
......@@ -37,12 +37,13 @@ import state from './state';
export default new Vuex.Store({
export const createStore = () => new Vuex.Store({
export default createStore();
### `state.js`
......@@ -320,10 +321,11 @@ In order to write unit tests for those components, we need to include the store
import Vue from 'vue';
import store from './store';
import { createStore } from './store';
import component from './component.vue'
describe('component', () => {
let store;
let vm;
let Component;
......@@ -340,6 +342,8 @@ describe('component', () => {
name: 'Foo',
age: '30',
store = createStore();
// populate the store
store.dispatch('addUser', user);
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