]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
test: app level injections
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 17 May 2023 07:51:03 +0000 (09:51 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Wed, 17 May 2023 08:26:48 +0000 (10:26 +0200)
packages/pinia/__tests__/storeSetup.spec.ts

index a11044bbff46424dab7bdf0e08dbc231ea7c8d90..aca2ab7d488cf58dfcdfdc3024cdadd2dfa61a32 100644 (file)
@@ -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<T>(_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'))