Wallet/test/mocks/FakeLocalStorage.js
Matias Alejo Garcia b3ed2a2ea8 start fixing tests
2014-09-15 14:17:20 -03:00

26 lines
441 B
JavaScript

//localstorage Mock
ls = {};
function LocalStorage(opts) {
}
FakeLocalStorage = {};
FakeLocalStorage.length = 0;
FakeLocalStorage.removeItem = function(key) {
delete ls[key];
};
FakeLocalStorage.getItem = function(k,cb) {
return cb(ls[k]);
};
FakeLocalStorage.allKeys = function(cb) {
return cb(Object.keys(ls));
};
FakeLocalStorage.setItem = function(k, v,cb) {
ls[k] = v;
return cb();
};
module.exports = FakeLocalStorage;