test: keep what was chosen for a store that waits for a new sign-in

This commit is contained in:
Linus Rath
2026-11-03 10:51:36 +01:00
parent e0abc7fa18
commit 4044351611
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -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');
@@ -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 }) });