local-storage.test.ts 594 B

12345678910111213141516
  1. import { clearLocalStorage, LOCAL_STORAGE_KEYS } from 'common'
  2. import { describe, expect, it } from 'vitest'
  3. describe('clearLocalStorage', () => {
  4. it('preserves queue operations preferences while removing non-allowlisted keys', () => {
  5. localStorage.clear()
  6. localStorage.setItem(LOCAL_STORAGE_KEYS.UI_PREVIEW_QUEUE_OPERATIONS, 'true')
  7. localStorage.setItem('not-allowlisted', 'remove-me')
  8. clearLocalStorage()
  9. expect(localStorage.getItem(LOCAL_STORAGE_KEYS.UI_PREVIEW_QUEUE_OPERATIONS)).toBe('true')
  10. expect(localStorage.getItem('not-allowlisted')).toBeNull()
  11. })
  12. })