habitica-self-host/website/client/tests/unit/helpers.js

24 lines
452 B
JavaScript
Raw Normal View History

2019-10-15 13:32:53 +00:00
/* eslint-disable import/no-commonjs */
require('../../../../test/helpers/globals.helper.js');
// Shim localStorage
const localStorage = {
data: {},
getItem (key) {
return this.data[key];
},
setItem (key, value) {
this.data[key] = value;
},
removeItem (key) {
delete this.data[key];
},
};
Object.defineProperty(window, 'localStorage', {
value: localStorage,
configurable: true,
enumerable: true,
writable: true,
});