@@ -20,7 +20,7 @@ describe('renderer/utils/core/storage.ts', () => {
2020 expect ( localStorage . getItem ( Constants . STORAGE . LEGACY ) ) . toBeNull ( ) ;
2121 } ) ;
2222
23- it ( 'migrates legacy auth and settings into the stores and marks the key as migrated ' , ( ) => {
23+ it ( 'migrates legacy auth and settings into the stores and removes the legacy key ' , ( ) => {
2424 localStorage . setItem (
2525 Constants . STORAGE . LEGACY ,
2626 JSON . stringify ( {
@@ -36,9 +36,7 @@ describe('renderer/utils/core/storage.ts', () => {
3636 expect ( useSettingsStore . getState ( ) . theme ) . toBe ( Theme . DARK ) ;
3737 expect ( useSettingsStore . getState ( ) . playSound ) . toBe ( false ) ;
3838
39- const marker = JSON . parse ( localStorage . getItem ( Constants . STORAGE . LEGACY ) ! ) ;
40- expect ( marker . migrated ) . toBe ( true ) ;
41- expect ( marker . migratedAt ) . toBeDefined ( ) ;
39+ expect ( localStorage . getItem ( Constants . STORAGE . LEGACY ) ) . toBeNull ( ) ;
4240 } ) ;
4341
4442 it ( 'drops legacy accounts with invalid hostnames during migration' , ( ) => {
@@ -68,17 +66,13 @@ describe('renderer/utils/core/storage.ts', () => {
6866 expect ( useAccountsStore . getState ( ) . accounts ) . toHaveLength ( 1 ) ;
6967 } ) ;
7068
71- it ( 'skips migration when already migrated' , ( ) => {
72- localStorage . setItem (
73- Constants . STORAGE . LEGACY ,
74- JSON . stringify ( { migrated : true , migratedAt : '2026-01-01T00:00:00Z' } ) ,
75- ) ;
69+ it ( 'removes a legacy key with no migratable data' , ( ) => {
70+ localStorage . setItem ( Constants . STORAGE . LEGACY , JSON . stringify ( { } ) ) ;
7671
7772 migrateLegacyStoreToZustand ( ) ;
7873
7974 expect ( useAccountsStore . getState ( ) . accounts ) . toEqual ( [ ] ) ;
80- const marker = JSON . parse ( localStorage . getItem ( Constants . STORAGE . LEGACY ) ! ) ;
81- expect ( marker . migratedAt ) . toBe ( '2026-01-01T00:00:00Z' ) ;
75+ expect ( localStorage . getItem ( Constants . STORAGE . LEGACY ) ) . toBeNull ( ) ;
8276 } ) ;
8377
8478 it ( 'logs an error and leaves stores untouched on malformed legacy data' , ( ) => {
0 commit comments