Skip to content
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

chore: globally .use(Vuex) when using instantiated store #247

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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