Skip to content

Commit 32ce160

Browse files
HusamElbashireddyerburgh
authored andcommitted
docs: fix typos/style inconsistencies in using-with-vuex.md (#1126)
1 parent d61b559 commit 32ce160

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

Diff for: docs/guides/using-with-vuex.md

+10-11
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ describe('Actions.vue', () => {
6262
actionInput: jest.fn()
6363
}
6464
store = new Vuex.Store({
65-
state: {},
6665
actions
6766
})
6867
})
@@ -126,7 +125,7 @@ Great, so now we can mock actions, let’s look at mocking getters.
126125
</script>
127126
```
128127

129-
This is a fairly simple component. It renders the result of the getters `clicks` and `inputValue`. Again, we don’t really care about what those getters returns – just that the result of them is being rendered correctly.
128+
This is a fairly simple component. It renders the result of the getters `clicks` and `inputValue`. Again, we don’t really care about what those getters return – just that their result is being rendered correctly.
130129

131130
Let’s see the test:
132131

@@ -154,13 +153,13 @@ describe('Getters.vue', () => {
154153
})
155154
})
156155

157-
it('Renders "state.inputValue" in first p tag', () => {
156+
it('Renders "store.getters.inputValue" in first p tag', () => {
158157
const wrapper = shallowMount(Getters, { store, localVue })
159158
const p = wrapper.find('p')
160159
expect(p.text()).toBe(getters.inputValue())
161160
})
162161

163-
it('Renders "state.clicks" in second p tag', () => {
162+
it('Renders "store.getters.clicks" in second p tag', () => {
164163
const wrapper = shallowMount(Getters, { store, localVue })
165164
const p = wrapper.findAll('p').at(1)
166165
expect(p.text()).toBe(getters.clicks().toString())
@@ -245,7 +244,7 @@ describe('MyComponent.vue', () => {
245244
expect(actions.moduleActionClick).toHaveBeenCalled()
246245
})
247246

248-
it('renders "state.inputValue" in first p tag', () => {
247+
it('renders "state.clicks" in first p tag', () => {
249248
const wrapper = shallowMount(MyComponent, { store, localVue })
250249
const p = wrapper.find('p')
251250
expect(p.text()).toBe(state.clicks.toString())
@@ -290,7 +289,7 @@ First, let's test the `increment` mutations:
290289

291290
import mutations from './mutations'
292291

293-
test('increment increments state.count by 1', () => {
292+
test('"increment" increments "state.count" by 1', () => {
294293
const state = {
295294
count: 0
296295
}
@@ -306,14 +305,14 @@ Now let's test the `evenOrOdd` getter. We can test it by creating a mock `state`
306305

307306
import getters from './getters'
308307

309-
test('evenOrOdd returns even if state.count is even', () => {
308+
test('"evenOrOdd" returns even if "state.count" is even', () => {
310309
const state = {
311310
count: 2
312311
}
313312
expect(getters.evenOrOdd(state)).toBe('even')
314313
})
315314

316-
test('evenOrOdd returns odd if state.count is odd', () => {
315+
test('"evenOrOdd" returns odd if "state.count" is odd', () => {
317316
const state = {
318317
count: 1
319318
}
@@ -325,7 +324,7 @@ test('evenOrOdd returns odd if state.count is odd', () => {
325324

326325
Another approach to testing a Vuex store is to create a running store using the store config.
327326

328-
The benefit of testing creating a running store instance is we don't have to mock any Vuex functions.
327+
The benefit of creating a running store instance is we don't have to mock any Vuex functions.
329328

330329
The downside is that when a test breaks, it can be difficult to find where the problem is.
331330

@@ -354,7 +353,7 @@ import Vuex from 'vuex'
354353
import storeConfig from './store-config'
355354
import { cloneDeep } from 'lodash'
356355

357-
test('increments count value when increment is commited', () => {
356+
test('increments "count" value when "increment" is commited', () => {
358357
const localVue = createLocalVue()
359358
localVue.use(Vuex)
360359
const store = new Vuex.Store(cloneDeep(storeConfig))
@@ -363,7 +362,7 @@ test('increments count value when increment is commited', () => {
363362
expect(store.state.count).toBe(1)
364363
})
365364

366-
test('updates evenOrOdd getter when increment is commited', () => {
365+
test('updates "evenOrOdd" getter when "increment" is commited', () => {
367366
const localVue = createLocalVue()
368367
localVue.use(Vuex)
369368
const store = new Vuex.Store(cloneDeep(storeConfig))

0 commit comments

Comments
 (0)