mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-04 08:15:41 +00:00
test: keep what was chosen for a store that waits for a new sign-in
This commit is contained in:
@@ -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 }) });
|
||||
|
||||
Reference in New Issue
Block a user