Skip to content

Commit 7101b07

Browse files
38elementseddyerburgh
authored andcommitted
docs: tweaks (#420)
1 parent 98c730a commit 7101b07

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

docs/en/api/wrapper-array/filter.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ A new `WrapperArray` instance containing `Wrapper` instances that returns true f
1414
- **Example:**
1515

1616
```js
17-
import { shallow } from 'vue-test-utils'
18-
import { expect } from 'chai'
17+
import { shallow } from '@vue/test-utils'
1918
import Foo from './Foo.vue'
2019

2120
const wrapper = shallow(Foo)

docs/en/guides/using-with-vuex.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ The most important thing to note in this test is that **we create a mock Vuex st
109109

110110
Great, so now we can mock actions, let’s look at mocking getters.
111111

112-
## Mocking Getters
112+
### Mocking Getters
113113

114114

115115
``` html
@@ -178,7 +178,7 @@ This test is similar to our actions test. We create a mock store before each tes
178178

179179
This is great, but what if we want to check our getters are returning the correct part of our state?
180180

181-
## Mocking with Modules
181+
### Mocking with Modules
182182

183183
[Modules](https://vuex.vuejs.org/en/modules.html) are useful for separating out our store into manageable chunks. They also export getters. We can use these in our tests.
184184

@@ -274,7 +274,6 @@ export default {
274274
state.count++
275275
}
276276
}
277-
278277
```
279278

280279
```js
@@ -286,7 +285,7 @@ export default {
286285

287286
### Testing getters, mutations, and actions separately
288287

289-
Getters, mutations, and actions are all JavaScript functions, so we can test them without using `vue-test-utils` or Vuex.
288+
Getters, mutations, and actions are all JavaScript functions, so we can test them without using `vue-test-utils` and Vuex.
290289

291290
The benefit to testing getters, mutations, and actions separately is that your unit tests are detailed. When they fail, you know exactly what is wrong with your code. The downside is that you will need to mock Vuex funtions, like `commit` and `dispatch`. This can lead to a situation where your unit tests pass, but your production code fails because your mocks are incorrect.
292291

@@ -333,7 +332,7 @@ test('evenOrOdd returns odd if state.count is even', () => {
333332

334333
### Testing a running store
335334

336-
Anopther approach to testing a Vuex store is to create a running store using the store config.
335+
Another approach to testing a Vuex store is to create a running store using the store config.
337336

338337
The benefit of testing creating a running store instance is we don't have to mock any Vuex functions.
339338

@@ -383,7 +382,7 @@ test('updates evenOrOdd getter when increment is commited', () => {
383382

384383
Notice that we use `cloneDeep` to clone the store config before creating a store with it. This is because Vuex mutates the options object used to create the store. To make sure we have a clean store in each test, we need to clone the `storeConfig` object.
385384

386-
### Resources
385+
## Resources
387386

388387
- [Example project for testing the components](https://github.com/eddyerburgh/vue-test-utils-vuex-example)
389388
- [Example project for testing the store](https://github.com/eddyerburgh/testing-vuex-store-example)

0 commit comments

Comments
 (0)