VueJS :: Vuex :: Testing
Good Links To Summarize
-
Jest is a delightful JavaScript Testing Framework with a focus on simplicity. It works with projects using: Babel, TypeScript, Node, React, Angular, Vue and more!
-
This article will teach you two different approaches for unit testing a Vuex store. You’ll learn how to test each of the store parts separately, and how to test a running store instance.
Using with Vuex - Vue Text Utils
In this guide, we'll see how to test Vuex in components with Vue Test Utils, and how to approach testing a Vuex store.
Vue Test Actions - vue-test-actions
Unit testing Vuex actions with Jest mocks.
-
A collection of short, focused examples on how to test Vue components. It uses vue-test-utils, the official library for testing Vue components, and Jest, a modern testing framework. It covers the vue-test-utils API, as well as best practises for testing components.
Testing Vuex Actions Correctly with Jest
Testing actions in isolation is very straight forward. Actions should be decoupled and tested independently of the components that dispatch them. Testing actions in the context of a component is correctly dispatching them is discussed in the linked article.
Unit testing Vuex actions with Jest mocks
Accessing an external service is something frequently done within SPAs, and often critical to your application’s core functionality — so in this article I’ll take a look at how to unit test Vuex actions, and the components that dispatch them.