Testing vuex
summary
Covers concrete advice for testing Vuex: three approaches—don't test the store, test actions/mutations/getters separately, or test a running store instance—with pros and cons. Shows Jest mocking to replace API calls, using createLocalVue to install Vuex without polluting global Vue, and recommends extracting a fresh store factory so each test gets a new state. Demonstrates dispatching an async fetch and asserting state update, trading brittle fine‑grained tests for easier refactoring with instance tests.
AI-written summary · about
chapters (6)
- 0:00Introduction to unit testing
- 2:59Understanding the Vuex store
- 4:28The first approach: no testing
- 5:44Testing parts separately
- 10:45Testing the store instance
- 17:55Choosing an approach and Q&A
related talks
26mUnit testing a Vuex store
31mNext Level Jest Testing
56mIntroducing Vuex in your project
37mThe Importance of State Management in Vue
25mHow to stay sane while managing complex state, in Vue js
26mVuex Modules in practice
49mVue and Vuex: Structure your app with centralized state management
23mSeven ways to make your Vue component tests better
