Skip to content

Commit 2eef8bd

Browse files
committed
test: add failing skipped test for storeToRefs and reactive
1 parent fbdd57e commit 2eef8bd

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

packages/pinia/__tests__/storeToRefs.spec.ts

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { computed, ref, ToRefs } from 'vue'
1+
import { computed, reactive, ref, ToRefs } from 'vue'
22
import { createPinia, defineStore, setActivePinia, storeToRefs } from '../src'
33

44
describe('storeToRefs', () => {
@@ -45,6 +45,45 @@ describe('storeToRefs', () => {
4545
expect(d.value).toBe('e')
4646
})
4747

48+
it.skip('setup store', () => {
49+
const store = defineStore('a', () => {
50+
return {
51+
a: ref<null | undefined>(null),
52+
b: ref(false),
53+
c: ref(1),
54+
d: ref('d'),
55+
r: reactive({ n: 1 }),
56+
}
57+
})()
58+
59+
const { a, b, c, d, r } = storeToRefs(store)
60+
61+
expect(a.value).toBe(null)
62+
expect(b.value).toBe(false)
63+
expect(c.value).toBe(1)
64+
expect(d.value).toBe('d')
65+
expect(r.value).toEqual({ n: 1 })
66+
67+
a.value = undefined
68+
expect(a.value).toBe(undefined)
69+
70+
b.value = true
71+
expect(b.value).toBe(true)
72+
73+
c.value = 2
74+
expect(c.value).toBe(2)
75+
76+
d.value = 'e'
77+
expect(d.value).toBe('e')
78+
79+
r.value.n++
80+
expect(r.value).toEqual({ n: 2 })
81+
expect(store.r).toEqual({ n: 2 })
82+
store.r.n++
83+
expect(r.value).toEqual({ n: 2 })
84+
expect(store.r).toEqual({ n: 2 })
85+
})
86+
4887
it('empty getters', () => {
4988
expect(
5089
storeToRefs(

0 commit comments

Comments
 (0)