diff --git a/packages/browser/src/core/storage/__tests__/universalStorage.test.ts b/packages/browser/src/core/storage/__tests__/universalStorage.test.ts index 93bdaffc9..3c813ebb9 100644 --- a/packages/browser/src/core/storage/__tests__/universalStorage.test.ts +++ b/packages/browser/src/core/storage/__tests__/universalStorage.test.ts @@ -126,5 +126,19 @@ describe('UniversalStorage', function () { expect(jar.get('ajs_test_key')).toEqual('💰') expect(us.get('ajs_test_key')).toEqual('💰') }) + + it('handles cookie getter overrides gracefully', function () { + ;(document as any).__defineGetter__('cookie', function () { + return '' + }) + const us = new UniversalStorage([ + new LocalStorage(), + new CookieStorage(), + new MemoryStorage(), + ]) + us.set('ajs_test_key', '💰') + expect(getFromLS('ajs_test_key')).toEqual('💰') + expect(us.get('ajs_test_key')).toEqual('💰') + }) }) }) diff --git a/packages/browser/src/core/user/__tests__/storage.test.ts b/packages/browser/src/core/user/__tests__/storage.test.ts deleted file mode 100644 index 30100a30c..000000000 --- a/packages/browser/src/core/user/__tests__/storage.test.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Cookie } from '..' - -describe('Cookie storage', () => { - it('should report cookie storage available when cookies are accessible', () => { - expect(Cookie.available()).toBe(true) - }) - - it('should report cookie storage unavailable when cookies are not accessible', () => { - ;(document as any).__defineGetter__('cookie', function () { - return '' - }) - - expect(Cookie.available()).toBe(false) - }) -})