Files
karma/assets/static/__mocks__/localStorageMock.js
Łukasz Mierzwa f0dc85ad0b Pass storage implementation as an argument
Instead of assuming that window.localStorage is always used pass it via arguments
2017-08-11 16:40:29 -07:00

22 lines
311 B
JavaScript

class LocalStorageMock {
constructor() {
this.store = {};
}
getItem(key) {
return this.store[key] || null;
}
setItem(key, value) {
this.store[key] = value.toString();
}
clear() {
this.store = {};
}
}
module.exports = new LocalStorageMock();