copay/test/mocks/FakeStorage.js

41 lines
849 B
JavaScript
Raw Normal View History

2014-03-26 13:55:02 -07:00
var FakeStorage = function(){
this.storage = {};
};
2014-05-01 11:12:38 -07:00
FakeStorage.prototype._setPassphrase = function (password) {
this.storage.passphrase = password;
};
2014-04-15 10:55:09 -07:00
FakeStorage.prototype.setGlobal = function (id, payload) {
2014-04-09 10:30:12 -07:00
this.storage[id] = payload;
2014-03-26 13:55:02 -07:00
};
2014-04-15 10:55:09 -07:00
FakeStorage.prototype.getGlobal = function(id) {
2014-04-09 10:30:12 -07:00
return this.storage[id];
2014-03-26 13:55:02 -07:00
}
2014-04-15 10:55:09 -07:00
FakeStorage.prototype.set = function (wid, id, payload) {
this.storage[wid + '-' + id] = payload;
};
FakeStorage.prototype.get = function(wid, id) {
return this.storage[wid + '-' +id];
}
FakeStorage.prototype.clear = function() {
delete this['storage'];
}
2014-04-24 19:42:59 -07:00
FakeStorage.prototype.getWallets = function() {
return [];
};
FakeStorage.prototype.setFromObj = function(walletId, obj) {
for (var i in obj) {
this.storage[walletId + '-' + i] = obj[i];
};
};
2014-03-26 13:55:02 -07:00
module.exports = require('soop')(FakeStorage);