From: Eduardo San Martin Morote Date: Wed, 17 May 2023 07:51:03 +0000 (+0200) Subject: test: app level injections X-Git-Tag: @pinia/nuxt@0.4.11~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d41a5d014ac0d21d9628bdd8dacb5653387eb87;p=thirdparty%2Fvuejs%2Fpinia.git test: app level injections --- diff --git a/packages/pinia/__tests__/storeSetup.spec.ts b/packages/pinia/__tests__/storeSetup.spec.ts index a11044bb..aca2ab7d 100644 --- a/packages/pinia/__tests__/storeSetup.spec.ts +++ b/packages/pinia/__tests__/storeSetup.spec.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, it, expect, vi } from 'vitest' import { createPinia, defineStore, setActivePinia } from '../src' -import { computed, inject, nextTick, ref, watch } from 'vue' +import { computed, createApp, inject, nextTick, ref, watch } from 'vue' function expectType(_value: T): void {} @@ -133,10 +133,10 @@ describe('store with setup syntax', () => { expect(counter.value).toBe(2) }) - // TODO: - it.todo('can use app level injections', async () => { + it('can use app level injections', async () => { const pinia = createPinia() - setActivePinia(pinia) + const app = createApp({}).use(pinia) + app.provide('hello', 'pinia') const useStore = defineStore('id', () => { const injected = ref(inject('hello', 'nope'))