mirror of
https://github.com/IT4Change/boilerplate-frontend.git
synced 2025-12-13 07:35:53 +00:00
feat: test store
This commit is contained in:
parent
82c147ad07
commit
d8209e1f9b
29
src/stores/counter.test.ts
Normal file
29
src/stores/counter.test.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { setActivePinia, createPinia } from 'pinia'
|
||||||
|
import { describe, it, expect } from 'vitest'
|
||||||
|
|
||||||
|
import { useCounterStore } from './counter'
|
||||||
|
|
||||||
|
describe('Counter Store', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
setActivePinia(createPinia())
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('increment', () => {
|
||||||
|
it('increments', () => {
|
||||||
|
const counter = useCounterStore()
|
||||||
|
expect(counter.count).toBe(0)
|
||||||
|
counter.increment()
|
||||||
|
expect(counter.count).toBe(1)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('resets', () => {
|
||||||
|
it('increments by amount', () => {
|
||||||
|
const counter = useCounterStore()
|
||||||
|
counter.increment()
|
||||||
|
expect(counter.count).toBe(1)
|
||||||
|
counter.reset()
|
||||||
|
expect(counter.count).toBe(0)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user