diff --git a/lib/__tests__/sign-out-cleanup.test.ts b/lib/__tests__/sign-out-cleanup.test.ts index 005865d76..e0071adfb 100644 --- a/lib/__tests__/sign-out-cleanup.test.ts +++ b/lib/__tests__/sign-out-cleanup.test.ts @@ -26,7 +26,7 @@ describe('purgeSignedOutData', () => { for (const key of [ 'email-snapshot', 'pro-tabs', 'search-history-storage', 'calendar-storage', 'files-favorites', 'files-recent-files', 'files-path-stack', 'bulwark-delegate-names', - 'bulwark-offline-accounts', 'bulwark-offline-choices', 'bulwark-offline-health', + 'bulwark-offline-accounts', 'bulwark-offline-scope', 'bulwark-offline-health', 'settings-storage', 'theme-storage', 'locale-storage', 'template-storage', 'files-view-mode', ]) localStorage.setItem(key, 'x'); diff --git a/lib/offline/__tests__/storage-health.test.ts b/lib/offline/__tests__/storage-health.test.ts index 49400a0f1..064542837 100644 --- a/lib/offline/__tests__/storage-health.test.ts +++ b/lib/offline/__tests__/storage-health.test.ts @@ -313,6 +313,16 @@ describe('removing an account', () => { }); describe('a full sign-out', () => { + it('that keeps the local store for a new sign-in keeps what was chosen for it too', () => { + writeEnabled(['acc']); + writeChoice('acc', { days: 30 }); + writeHealth('acc', { pending: 2 }); + purgeSignedOutData({ keepLocalStore: true }); + expect(JSON.parse(localStorage.getItem(OFFLINE_SCOPE_KEY)!).acc.days).toBe(30); + expect(JSON.parse(localStorage.getItem(OFFLINE_HEALTH_KEY)!).acc.pending).toBe(2); + expect(useOfflineStore.getState().choices.acc.days).toBe(30); + }); + it('deletes the files, every key and what was stored about them', async () => { const removeEntry = vi.fn(async () => {}); setStorage({ getDirectory: async () => ({ removeEntry }) });