diff --git a/packages/pinia/__tests__/multipleRoots.spec.ts b/packages/pinia/__tests__/multipleRoots.spec.ts
index 3efdcfe6ef..bfd318301f 100644
--- a/packages/pinia/__tests__/multipleRoots.spec.ts
+++ b/packages/pinia/__tests__/multipleRoots.spec.ts
@@ -4,8 +4,7 @@ import { defineComponent } from 'vue'
describe('Multiple Roots', () => {
function defineMyStore() {
- return defineStore({
- id: 'main',
+ return defineStore('main', {
state: () => ({
n: 0,
}),
@@ -13,7 +12,6 @@ describe('Multiple Roots', () => {
}
it('uses the same root in child components by default', () => {
- expect.assertions(2)
const pinia = createPinia()
const useStore = defineMyStore()
@@ -37,10 +35,12 @@ describe('Multiple Roots', () => {
},
{ global: { plugins: [pinia] } }
)
+
+ const store = useStore()
+ expect(store.n).toBe(1)
})
it('can use a new pinia root for all child components', async () => {
- expect.assertions(2)
const pinia = createPinia()
const useStore = defineMyStore()
@@ -64,35 +64,8 @@ describe('Multiple Roots', () => {
},
{ global: { plugins: [pinia] } }
)
- })
-
- it('state is shared between child components', async () => {
- expect.assertions(3)
- const pinia = createPinia()
- const useStore = defineMyStore()
- const ChildComponent = defineComponent({
- template: 'no',
- props: { counter: { type: Number, required: true } },
- setup(props: { counter: number }) {
- const store = useStore()
- expect(store.n).toBe(props.counter)
- store.n++
- },
- })
- mount(
- {
- template:
- '',
- components: { ChildComponent },
- setup() {
- const store = useStore()
- expect(store.n).toBe(0)
- store.n++
- providePinia(createPinia())
- },
- },
- { global: { plugins: [pinia] } }
- )
+ const store = useStore()
+ expect(store.n).toBe(0)
})
})