callCount: 0,
}),
getters: {
- upperCaseName() {
+ upperCaseName(): string {
return this.name.toUpperCase()
},
// works for js users but cannot be typed at the same time as `this`
id: 'A',
state: () => ({ a: 'a' }),
getters: {
- fromB() {
+ fromB(): string {
const bStore = useB()
return this.a + ' ' + bStore.b
},
},
}),
getters: {
- double() {
- return this.n * 2
- },
- notA() {
- return !this.a
- },
+ double: (state) => state.n * 2,
+ notA: (state) => !state.a,
},
actions: {
doubleCount() {
const wrapper = mount(Component, { localVue, pinia })
// const store = useStore()
// const other = useCartStore()
+ // @ts-expect-error: not handled by VTU
expect(wrapper.vm.mainStore).toBeDefined()
expect(wrapper.text()).toBe('0')
await nextTick()
const wrapper = mount(Component, { localVue, pinia })
// const store = useStore()
// const other = useCartStore()
+ // @ts-expect-error: not handled by VTU
expect(wrapper.vm.main).toBeDefined()
+ // @ts-expect-error: not handled by VTU
expect(wrapper.vm.mainStore).not.toBeDefined()
expect(wrapper.text()).toBe('0')
await nextTick()
const wrapper = mount(Component, { localVue, pinia })
+ // @ts-expect-error: not handled by VTU
expect(wrapper.vm.increment()).toBe(undefined)
+ // @ts-expect-error: not handled by VTU
expect(wrapper.vm.setN(4)).toBe(4)
})
const wrapper = mount(Component, { localVue, pinia })
+ // @ts-expect-error: not handled by VTU
expect(wrapper.vm.inc()).toBe(undefined)
+ // @ts-expect-error: not handled by VTU
expect(wrapper.vm.set(4)).toBe(4)
})
})