mirror of https://github.com/BTCPrivate/copay.git
fix tests
This commit is contained in:
parent
abcbda8cf4
commit
5ff8ad236a
|
@ -161,7 +161,7 @@ Wallet.prototype._handleData = function(senderId, data, isInbound) {
|
|||
Wallet.prototype._handleConnect = function(newCopayerId) {
|
||||
if (newCopayerId) {
|
||||
this.log('#### Setting new COPAYER:', newCopayerId);
|
||||
this.currentDelay = this.reconnectDelay;
|
||||
this.currentDelay = null;
|
||||
this.sendWalletId(newCopayerId);
|
||||
}
|
||||
var peerID = this.network.peerFromCopayer(newCopayerId)
|
||||
|
@ -251,6 +251,7 @@ Wallet.prototype.netStart = function() {
|
|||
if (this.publicKeyRing.isComplete()) {
|
||||
this._lockIncomming();
|
||||
}
|
||||
|
||||
net.start(startOpts, function() {
|
||||
self.emit('ready', net.getPeer());
|
||||
self.token = net.peer.options.token;
|
||||
|
@ -265,11 +266,9 @@ Wallet.prototype.netStart = function() {
|
|||
|
||||
Wallet.prototype.scheduleConnect = function() {
|
||||
var self = this;
|
||||
self.currentDelay = self.currentDelay || self.reconnectDelay;
|
||||
|
||||
if (self.network.isOnline()) {
|
||||
self.connectToAll();
|
||||
self.currentDelay *=2;
|
||||
self.currentDelay = self.currentDelay*2 || self.reconnectDelay;
|
||||
setTimeout(self.scheduleConnect.bind(self), self.currentDelay);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,20 +237,18 @@ describe('Wallet model', function() {
|
|||
throw ();
|
||||
});
|
||||
|
||||
it.only('call reconnect after interval', function(done) {
|
||||
it('call reconnect after interval', function(done) {
|
||||
var w = createW2();
|
||||
var testTime = 1000;
|
||||
var callCount = 0;
|
||||
var cT=w.reconnectDelay;
|
||||
console.log('[test.Wallet.js.238:cT:]',cT); //TODO
|
||||
var t=0;
|
||||
|
||||
do {
|
||||
callCount++;
|
||||
t += cT;
|
||||
cT *= 2;
|
||||
console.log('[test.Wallet.js.242]',t, callCount); //TODO
|
||||
} while (t<testTime);
|
||||
console.log('[test.Wallet.js.241:callCount:]',callCount); //TODO
|
||||
|
||||
var spy = sinon.spy(w, 'scheduleConnect');
|
||||
w.netStart();
|
||||
|
|
Loading…
Reference in New Issue