1- import { afterEach , beforeEach , describe , expect , it , vi } from 'vitest'
1+ import { beforeEach , describe , expect , it , vi } from 'vitest'
22
33describe ( 'useSettings - keyboardShortcuts' , ( ) => {
44 beforeEach ( ( ) => {
5- localStorage . clear ( )
6- vi . resetModules ( )
7- } )
8-
9- afterEach ( ( ) => {
10- // Reset the singleton so the next test gets a fresh instance
11- localStorage . clear ( )
125 vi . resetModules ( )
136 } )
147
@@ -29,6 +22,7 @@ describe('useSettings - keyboardShortcuts', () => {
2922
3023 it ( 'should reflect changes made via settings' , async ( ) => {
3124 const { useSettings } = await import ( '../../../app/composables/useSettings' )
25+ const { useKeyboardShortcuts } = await import ( '../../../app/composables/useSettings' )
3226 const { settings } = useSettings ( )
3327 const enabled = useKeyboardShortcuts ( )
3428
@@ -51,25 +45,4 @@ describe('useSettings - keyboardShortcuts', () => {
5145 expect ( enabled . value ) . toBe ( false )
5246 } )
5347 } )
54-
55- describe ( 'persistence' , ( ) => {
56- it ( 'should persist keyboardShortcuts=false to localStorage' , async ( ) => {
57- const { useSettings } = await import ( '../../../app/composables/useSettings' )
58- const { settings } = useSettings ( )
59- settings . value . keyboardShortcuts = false
60-
61- const stored = JSON . parse ( localStorage . getItem ( 'npmx-settings' ) ?? '{}' )
62- expect ( stored . keyboardShortcuts ) . toBe ( false )
63- } )
64-
65- it ( 'should persist keyboardShortcuts=true to localStorage' , async ( ) => {
66- const { useSettings } = await import ( '../../../app/composables/useSettings' )
67- const { settings } = useSettings ( )
68- settings . value . keyboardShortcuts = false
69- settings . value . keyboardShortcuts = true
70-
71- const stored = JSON . parse ( localStorage . getItem ( 'npmx-settings' ) ?? '{}' )
72- expect ( stored . keyboardShortcuts ) . toBe ( true )
73- } )
74- } )
7548} )
0 commit comments