]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
test: refactor plugin tests
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 3 May 2021 09:41:43 +0000 (11:41 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 3 May 2021 09:41:43 +0000 (11:41 +0200)
__tests__/storePlugins.spec.ts

index 62b508492df62adc10b3aac7685d71c09b9082e9..91785256211d4b74266636b57a3cf0c70ae4d565 100644 (file)
@@ -33,14 +33,14 @@ describe('store plugins', () => {
   it('adds properties to stores', () => {
     const pinia = createPinia()
     pinia.Vue = Vue
-    mount({ template: '<p/>' }, { localVue })
+    mount({ template: '<p/>' }, { localVue, pinia })
 
     // must call use after installing the plugin
     pinia.use(() => {
       return { n: 20 }
     })
 
-    const store = useStore(pinia)
+    const store = useStore()
 
     expect(store.n).toBe(20)
     // @ts-expect-error: n is a number
@@ -56,11 +56,11 @@ describe('store plugins', () => {
     pinia.use(() => ({ n: 1 }))
     pinia.use((pinia) => ({ hasPinia: !!pinia }))
 
-    mount({ template: '<p/>' }, { localVue })
+    mount({ template: '<p/>' }, { localVue, pinia })
 
     pinia.use((app) => ({ hasPinia: !!app }))
 
-    const store = useStore(pinia)
+    const store = useStore()
 
     expect(store.n).toBe(1)
     expect(store.hasPinia).toBe(true)
@@ -69,14 +69,14 @@ describe('store plugins', () => {
   it('can be used in actions', () => {
     const pinia = createPinia()
     pinia.Vue = Vue
-    mount({ template: '<p/>' }, { localVue })
+    mount({ template: '<p/>' }, { localVue, pinia })
 
     // must call use after installing the plugin
     pinia.use(() => {
       return { n: 20 }
     })
 
-    const store = useStore(pinia)
+    const store = useStore()
 
     expect(store.incrementN()).toBe(20)
   })
@@ -84,14 +84,14 @@ describe('store plugins', () => {
   it('can be used in getters', () => {
     const pinia = createPinia()
     pinia.Vue = Vue
-    mount({ template: '<p/>' }, { localVue })
+    mount({ template: '<p/>' }, { localVue, pinia })
 
     // must call use after installing the plugin
     pinia.use(() => {
       return { n: 20 }
     })
 
-    const store = useStore(pinia)
+    const store = useStore()
     expect(store.doubleN).toBe(40)
   })
 })