@@ -11,8 +11,7 @@ describe('Store', () => {
1111 setActivePinia ( createPinia ( ) )
1212 } )
1313
14- const useStore = defineStore ( {
15- id : 'main' ,
14+ const useStore = defineStore ( 'main' , {
1615 state : ( ) => ( {
1716 a : true ,
1817 nested : {
@@ -23,7 +22,7 @@ describe('Store', () => {
2322 } )
2423
2524 it ( 'reuses a store' , ( ) => {
26- const useStore = defineStore ( { id : 'main' } )
25+ const useStore = defineStore ( 'main' , { } )
2726 expect ( useStore ( ) ) . toBe ( useStore ( ) )
2827 } )
2928
@@ -56,8 +55,7 @@ describe('Store', () => {
5655 it ( 'works without setting the active pinia' , async ( ) => {
5756 setActivePinia ( undefined )
5857 const pinia = createPinia ( )
59- const useStore = defineStore ( {
60- id : 'main' ,
58+ const useStore = defineStore ( 'main' , {
6159 state : ( ) => ( { n : 0 } ) ,
6260 } )
6361 const TestComponent = defineComponent ( {
@@ -100,16 +98,15 @@ describe('Store', () => {
10098 } )
10199
102100 it ( 'can create an empty state if no state option is provided' , ( ) => {
103- const store = defineStore ( { id : 'some' } ) ( )
101+ const store = defineStore ( 'some' , { } ) ( )
104102
105103 expect ( store . $state ) . toEqual ( { } )
106104 } )
107105
108106 it ( 'can hydrate the state' , ( ) => {
109107 const pinia = createPinia ( )
110108 setActivePinia ( pinia )
111- const useStore = defineStore ( {
112- id : 'main' ,
109+ const useStore = defineStore ( 'main' , {
113110 state : ( ) => ( {
114111 a : true ,
115112 nested : {
@@ -177,8 +174,7 @@ describe('Store', () => {
177174
178175 it ( 'should outlive components' , async ( ) => {
179176 const pinia = createPinia ( )
180- const useStore = defineStore ( {
181- id : 'main' ,
177+ const useStore = defineStore ( 'main' , {
182178 state : ( ) => ( { n : 0 } ) ,
183179 } )
184180
@@ -250,7 +246,7 @@ describe('Store', () => {
250246
251247 it ( 'reuses stores from parent components' , ( ) => {
252248 let s1 , s2
253- const useStore = defineStore ( { id : 'one' } )
249+ const useStore = defineStore ( 'one' , { } )
254250 const pinia = createPinia ( )
255251
256252 const Child = defineComponent ( {
@@ -277,7 +273,7 @@ describe('Store', () => {
277273 } )
278274
279275 it ( 'can share the same pinia in two completely different instances' , async ( ) => {
280- const useStore = defineStore ( { id : 'one' , state : ( ) => ( { n : 0 } ) } )
276+ const useStore = defineStore ( 'one' , { state : ( ) => ( { n : 0 } ) } )
281277 const pinia = createPinia ( )
282278
283279 const Comp = defineComponent ( {
@@ -314,8 +310,7 @@ describe('Store', () => {
314310
315311 it ( 'can be disposed' , ( ) => {
316312 const pinia = createPinia ( )
317- const useStore = defineStore ( {
318- id : 'main' ,
313+ const useStore = defineStore ( 'main' , {
319314 state : ( ) => ( { n : 0 } ) ,
320315 } )
321316
@@ -341,8 +336,7 @@ describe('Store', () => {
341336 it ( 'warns when state is created with a class constructor' , ( ) => {
342337 class MyState { }
343338
344- const useMyStore = defineStore ( {
345- id : 'store' ,
339+ const useMyStore = defineStore ( 'store' , {
346340 state : ( ) => new MyState ( ) ,
347341 } )
348342 useMyStore ( )
@@ -351,17 +345,15 @@ describe('Store', () => {
351345
352346 it ( 'only warns about constructors when store is initially created' , ( ) => {
353347 class MyState { }
354- const useMyStore = defineStore ( {
355- id : 'arrowInit' ,
348+ const useMyStore = defineStore ( 'arrowInit' , {
356349 state : ( ) => new MyState ( ) ,
357350 } )
358351 useMyStore ( )
359352 expect ( warnTextCheckPlainObject ( 'arrowInit' ) ) . toHaveBeenWarnedTimes ( 1 )
360353 } )
361354
362355 it ( 'does not warn when state is created with a plain object' , ( ) => {
363- const useMyStore = defineStore ( {
364- id : 'poInit' ,
356+ const useMyStore = defineStore ( 'poInit' , {
365357 state : ( ) => ( { someValue : undefined } ) ,
366358 } )
367359 useMyStore ( )
0 commit comments