cannot set localStorage.__STORE__ to an empty object
iyunusov opened this issue · comments
Islom commented
when this is used localStorage.__STORE__ = {};
console returns:
TypeError: Cannot set property __STORE__ of #<LocalStorage> which has only a getter
Bryan Clark commented
Yeah, only a getter
https://github.com/clarkbw/jest-localstorage-mock/blob/master/src/localstorage.js#L42-L44
You want to use the clear
function https://github.com/clarkbw/jest-localstorage-mock/blob/master/src/localstorage.js#L20 instead
Andy Orahood commented
You should update the README as it still mentions this:
// or directly reset the storage
localStorage.__STORE__ = {};