]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
test: add skipped test
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 28 Jul 2021 07:55:53 +0000 (09:55 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Wed, 28 Jul 2021 07:55:53 +0000 (09:55 +0200)
__tests__/storeSetup.spec.ts

index 24a11ef5cd1a14c931f84b925234fe63783cb374..14d0eda7a01eb0f09bed4367049cd3c5acee75dc 100644 (file)
@@ -72,6 +72,20 @@ describe('store with setup syntax', () => {
     expect(spy).toHaveBeenCalledTimes(1)
   })
 
+  // TODO: could be fixed by using computed or getters + setters in store
+  it.skip('state refs can be watched', async () => {
+    const store = useStore()
+    const spy = jest.fn()
+    watch(() => store.name, spy)
+    expect(spy).not.toHaveBeenCalled()
+    const nameRef = ref('Ed')
+    store._p.state.value[store.$id].name = nameRef
+    // @ts-ignore
+    // store.$state.name = nameRef
+    await nextTick()
+    expect(spy).toHaveBeenCalledTimes(1)
+  })
+
   it('unwraps refs', () => {
     const name = ref('Eduardo')
     const counter = ref(0)