start fixing tests

This commit is contained in:
Matias Alejo Garcia 2014-09-04 18:07:09 -03:00
commit b3ed2a2ea8
4 changed files with 89 additions and 52 deletions

View file

@ -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;