Skip to content

Commit

Permalink
chore: globally .use(Vuex) when using instantiated store (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
blimmer authored Aug 1, 2021
1 parent 9d367e7 commit c25b1aa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/__tests__/vuex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '@testing-library/jest-dom'
import {render, fireEvent} from '@testing-library/vue'
import Vue from 'vue'
import Vuex from 'vuex'

import VuexTest from './components/Store/VuexTest'
Expand Down Expand Up @@ -57,6 +58,12 @@ test('can render with vuex with custom store', async () => {
})

test('can render with an instantiated Vuex store', async () => {
// Before calling new Vuex.Store in your code, you'll need to `.use` it on the
// global (or local) Vue instance. In frameworks like Jest, the `setupFilesAfterEnv`
// property is a good place to do this.
// https://jestjs.io/docs/configuration#setupfilesafterenv-array
Vue.use(Vuex)

const {getByTestId, getByText} = render(VuexTest, {
store: new Vuex.Store({
state: {count: 3},
Expand Down

0 comments on commit c25b1aa

Please sign in to comment.