|
1 | 1 | import '@testing-library/jest-dom'
|
2 | 2 | import {render, fireEvent} from '@testing-library/vue'
|
| 3 | +import Vue from 'vue' |
3 | 4 | import Vuex from 'vuex'
|
4 | 5 |
|
5 | 6 | import VuexTest from './components/Store/VuexTest'
|
@@ -57,6 +58,12 @@ test('can render with vuex with custom store', async () => {
|
57 | 58 | })
|
58 | 59 |
|
59 | 60 | test('can render with an instantiated Vuex store', async () => {
|
| 61 | + // Before calling new Vuex.Store in your code, you'll need to `.use` it on the |
| 62 | + // global (or local) Vue instance. In frameworks like Jest, the `setupFilesAfterEnv` |
| 63 | + // property is a good place to do this. |
| 64 | + // https://jestjs.io/docs/configuration#setupfilesafterenv-array |
| 65 | + Vue.use(Vuex) |
| 66 | + |
60 | 67 | const {getByTestId, getByText} = render(VuexTest, {
|
61 | 68 | store: new Vuex.Store({
|
62 | 69 | state: {count: 3},
|
|
0 commit comments