From 4044351611fc3f7652b788dd03e12ccaa7daa71a Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:51:36 +0100 Subject: [PATCH] test: keep what was chosen for a store that waits for a new sign-in --- lib/__tests__/sign-out-cleanup.test.ts | 2 +- lib/offline/__tests__/storage-health.test.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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 }) });