WIP: better lock
This commit is contained in:
parent
d8e0d50dce
commit
bcb61810d5
7 changed files with 121 additions and 139 deletions
|
|
@ -35,6 +35,11 @@ FakeStorage.prototype.getLock = function(id) {
|
|||
return this.storage[id + '::lock'];
|
||||
}
|
||||
|
||||
FakeStorage.prototype.getSessionId = function() {
|
||||
return this.sessionId || 'aSessionId';
|
||||
};
|
||||
|
||||
|
||||
FakeStorage.prototype.removeLock = function(id) {
|
||||
delete this.storage[id + '::lock'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,6 @@ describe('Wallet model', function() {
|
|||
cachedW2obj.opts.reconnectDelay = 100;
|
||||
}
|
||||
var w = Wallet.fromObj(cachedW2obj, cachedW2.storage, cachedW2.network, cachedW2.blockchain);
|
||||
w.unlock();
|
||||
return w;
|
||||
};
|
||||
|
||||
|
|
@ -1025,20 +1024,6 @@ describe('Wallet model', function() {
|
|||
w.network.start.getCall(0).args[0].privkey.length.should.equal(64);
|
||||
});
|
||||
|
||||
it('should check if wallet is already opened', function() {
|
||||
var w = cachedCreateW2();
|
||||
should.not.exist(w.getLock());
|
||||
w.checkAndLock().should.equal(false);
|
||||
w.getLock().should.equal(true);
|
||||
});
|
||||
it('should check if wallet is already opened', function() {
|
||||
var w = cachedCreateW2();
|
||||
should.not.exist(w.getLock());
|
||||
w.checkAndLock().should.equal(false);
|
||||
w.getLock().should.equal(true);
|
||||
});
|
||||
|
||||
|
||||
it('should not start if locked', function() {
|
||||
var w = cachedCreateW2();
|
||||
w.netStart();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue