expect(() => store.throws()).toThrowError('fail')
})
- it('throws errors', () => {
- const store = useStore()
- expect(() => store.throws()).toThrowError('fail')
- })
-
it('throws async errors', async () => {
const store = useStore()
expect.assertions(1)
{
$id: store.$id,
simple,
- // otherwise it would faial
+ // otherwise it would fail
toggle() {},
}.simple()
).toBe('simple')
setActivePinia(pinia1)
const aStore = useA()
- // simulate a different applications
+ // simulate a different application
setActivePinia(pinia2)
const bStore = useB()
bStore.b = 'c'
})
const wrapper = mount(Component, { global: { plugins: [pinia] } })
- // const store = useStore()
// @ts-expect-error: by default this shouldn't exist
expect(wrapper.vm.main).toBeDefined()
expect(wrapper.vm.mainStore).not.toBeDefined()
expect(pinia.state.value.main.nested.n).toBe(3)
})
- // it('watch', () => {
- // setActivePinia(createPinia())
- // defineStore({
- // id: 'main',
- // state: () => ({
- // name: 'Eduardo',
- // counter: 0,
- // }),
- // })()
- // })
-
it('state can be watched', async () => {
const store = useStore()
const spy = jest.fn()