import { getAuthentication, setAuthentication } from '../../src/utils/storage' describe('utils/storage', () => { beforeEach(() => { localStorage.clear() }) describe('getAuthentication', () => { it('returns a JS object for JSON stored as "ADAMoracle.authentication" in localStorage', () => { localStorage.setItem('ADAMoracle.authentication', '{"allowed":true}') expect(getAuthentication()).toEqual({ allowed: true }) }) }) describe('setAuthentication', () => { it('saves the JS object as JSON under the key "ADAMoracle.authentication" in localStorage', () => { setAuthentication({ allowed: true }) expect(localStorage.getItem('ADAMoracle.authentication')).toEqual( '{"allowed":true}', ) }) }) })