Skip to content

Commit

Permalink
docs: unify naming of store (#2190)
Browse files Browse the repository at this point in the history
  • Loading branch information
Theiaz committed May 10, 2023
1 parent 971dcdb commit 804e6d5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/docs/cookbook/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To unit test a store, the most important part is creating a `pinia` instance:
```js
// stores/counter.spec.ts
import { setActivePinia, createPinia } from 'pinia'
import { useCounter } from '../src/stores/counter'
import { useCounterStore } from '../src/stores/counter'

describe('Counter Store', () => {
beforeEach(() => {
Expand All @@ -37,14 +37,14 @@ describe('Counter Store', () => {
})

it('increments', () => {
const counter = useCounter()
const counter = useCounterStore()
expect(counter.n).toBe(0)
counter.increment()
expect(counter.n).toBe(1)
})

it('increments by amount', () => {
const counter = useCounter()
const counter = useCounterStore()
counter.increment(10)
expect(counter.n).toBe(10)
})
Expand Down Expand Up @@ -188,15 +188,15 @@ By default, any getter will be computed like regular usage but you can manually
import { defineStore } from 'pinia'
import { createTestingPinia } from '@pinia/testing'

const useCounter = defineStore('counter', {
const useCounterStore = defineStore('counter', {
state: () => ({ n: 1 }),
getters: {
double: (state) => state.n * 2,
},
})

const pinia = createTestingPinia()
const counter = useCounter(pinia)
const counter = useCounterStore(pinia)

counter.double = 3 // 馃獎 getters are writable only in tests

Expand Down

0 comments on commit 804e6d5

Please sign in to comment.