start fixing tests
This commit is contained in:
parent
e0db19a40a
commit
b3ed2a2ea8
4 changed files with 89 additions and 52 deletions
|
|
@ -1,27 +1,26 @@
|
|||
//localstorage Mock
|
||||
ls = {};
|
||||
function LocalStorage(opts) {}
|
||||
function LocalStorage(opts) {
|
||||
}
|
||||
|
||||
FakeLocalStorage = {};
|
||||
FakeLocalStorage.length = 0;
|
||||
FakeLocalStorage.removeItem = function(key) {
|
||||
delete ls[key];
|
||||
this.length = Object.keys(ls).length;
|
||||
};
|
||||
|
||||
FakeLocalStorage.getItem = function(k) {
|
||||
return ls[k];
|
||||
FakeLocalStorage.getItem = function(k,cb) {
|
||||
return cb(ls[k]);
|
||||
};
|
||||
|
||||
|
||||
FakeLocalStorage.key = function(i) {
|
||||
return Object.keys(ls)[i];
|
||||
FakeLocalStorage.allKeys = function(cb) {
|
||||
return cb(Object.keys(ls));
|
||||
};
|
||||
|
||||
FakeLocalStorage.setItem = function(k, v) {
|
||||
FakeLocalStorage.setItem = function(k, v,cb) {
|
||||
ls[k] = v;
|
||||
this.key[this.length] = k;
|
||||
this.length = Object.keys(ls).length;
|
||||
return cb();
|
||||
};
|
||||
|
||||
module.exports = FakeLocalStorage;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue