From 5ff8ad236a528f1aea67d98d9fb249a25733bd5d Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 9 Jun 2014 11:41:13 -0300 Subject: [PATCH] fix tests --- js/models/core/Wallet.js | 7 +++---- test/test.Wallet.js | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index dcef5dc0b..a26ef3423 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -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); } } diff --git a/test/test.Wallet.js b/test/test.Wallet.js index 4e7b614dc..925d7df5c 100644 --- a/test/test.Wallet.js +++ b/test/test.Wallet.js @@ -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