Skip to content

Commit

Permalink
fix: adding test for cookie getter override
Browse files Browse the repository at this point in the history
  • Loading branch information
oscb committed Aug 8, 2023
1 parent 47a36d1 commit 8332060
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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('💰')
})
})
})
15 changes: 0 additions & 15 deletions packages/browser/src/core/user/__tests__/storage.test.ts

This file was deleted.

0 comments on commit 8332060

Please sign in to comment.