-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Add examples #8
Comments
I've opened a PR with a simple example of how to test Vuex, it still need some work, I'll be adding some updates during the week (little busy at work..) |
@waghcwb : I really appreciate the help. Looking forward to it :) |
I saw PR. |
Sorry, I think I did not understand your question. We create the Vuex instance to mock the results for the tests. But I'm not fully experienced with Jest tests, maybe there's another way to do it. |
I think I gotcha. You can import your state, mutations, etc from the store and use as well. import { state as mockState, mutations as mockMutations } from '@/store';
const localVue = createLocalVue();
localVue.use(Vuex);
function createStore({ state, mutations, actions }) {
return new Vuex.Store({
state,
mutations,
actions,
});
}
let store = createStore({ state, mutations, actions });
test('component should mount', t => {
const wrapper = shallowMount(YourComponent, { localVue, store });
t.is(wrapper.isVueInstance(), true);
}); |
@jskim82, @vinayakkulkarni, |
Thank you~ |
The text was updated successfully, but these errors were encountered: