From: Eduardo San Martin Morote Date: Tue, 23 Jun 2020 08:14:40 +0000 (+0200) Subject: test: refactor not implemented X-Git-Tag: 0.1.0~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8f162cae886f9811703cc1f95aed1661a631db3c;p=thirdparty%2Fvuejs%2Fpinia.git test: refactor not implemented --- diff --git a/__tests__/pinia/stores/combined.ts b/__tests__/pinia/stores/combined.ts index 924ba959..e9457b00 100644 --- a/__tests__/pinia/stores/combined.ts +++ b/__tests__/pinia/stores/combined.ts @@ -1,15 +1,32 @@ import { useUserStore } from './user' import { useCartStore } from './cart' -import { pinia, CombinedState } from '../../../src/pinia' +import { pinia } from '../../../src' // in this file we could import other stores that use one each other while // avoiding any recursive import -type S = CombinedState<{ - user: typeof useUserStore - cart: typeof useCartStore -}> +// TODO: not implemented -let a: S +const useCartUserStore = pinia( + { user: useUserStore, cart: useCartStore }, + { + getters: { + combinedGetter: ({ user, cart }) => + `Hi ${user.state.name}, you have ${cart.state.list.length} items in your cart. It costs ${cart.price}.`, + }, + actions: { + async orderCart() { + try { + await apiOrderCart(this.user.state.token, this.cart.state.items) + this.cart.emptyCart() + } catch (err) { + displayError(err) + } + }, + }, + } +) + +const a = useCartUserStore() a.user.isAdmin = false a.cart.rawItems.push() diff --git a/src/ssrPlugin.ts b/src/ssrPlugin.ts index b45c0cc1..7962caad 100644 --- a/src/ssrPlugin.ts +++ b/src/ssrPlugin.ts @@ -28,7 +28,7 @@ export const PiniaSsr = (vue: VueConstructor) => { if (serverPrefetch) { const patchedServerPrefetch = Array.isArray(serverPrefetch) ? serverPrefetch.slice() - : // serverPrefetch not being an array cannot be triggered due tue options merge + : // serverPrefetch not being an array cannot be triggered due to options merge // https://github.com/vuejs/vue/blob/7912f75c5eb09e0aef3e4bfd8a3bb78cad7540d7/src/core/util/options.js#L149 /* istanbul ignore next */ [serverPrefetch]