uid: App['_uid']
hasApp: boolean
idFromPlugin: Id
+ globalA: string
+ globalB: string
}
}
},
},
})
+
it('adds properties to stores', () => {
const pinia = createPinia()
const store = useStore(pinia)
expect(store.doubleN).toBe(40)
})
+
+ it('allows chaining', () => {
+ const pinia = createPinia()
+
+ // must call use after installing the plugin
+ pinia.use(() => ({ globalA: 'a' })).use(() => ({ globalB: 'b' }))
+
+ mount({ template: 'none' }, { global: { plugins: [pinia] } })
+
+ const store = useStore(pinia)
+ expect(store.globalA).toBe('a')
+ expect(store.globalB).toBe('b')
+ })
})
*
* @param plugin - store plugin to add
*/
- use(plugin: PiniaStorePlugin): void
+ use(plugin: PiniaStorePlugin): Pinia
/**
* Installed store plugins
} else {
_p.push(plugin)
}
+ return this
},
_p,