Last active
April 23, 2021 02:26
-
-
Save lmiller1990/5eb1e4bbfc7b933b8bf1fad90e6d8517 to your computer and use it in GitHub Desktop.
mount.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// test utils v1 | |
import { mount as testUtilsMount, createLocalVue } from '@vue/test-utils' | |
import Vuex from 'vuex' | |
// some function to create a new Vuex store with your state/mutations etc | |
// you want a fresh one for each test | |
import { createMyVuexStore } from './vuex-store' | |
export function mount(comp, options = {}, store) { | |
const localVue = createLocalVue() | |
localVue.use(Vuex) | |
// create a default one if not provided | |
if (!store) { | |
store = createMyVuexStore() | |
} | |
return testUtilsMount(comp, {...options, store}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment