diff --git a/src/stores/counter.test.ts b/src/stores/counter.test.ts new file mode 100644 index 0000000..a4634ab --- /dev/null +++ b/src/stores/counter.test.ts @@ -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) + }) + }) +})