fix timeout test

This commit is contained in:
Manuel Araoz 2014-06-18 11:08:50 -03:00
parent e09d8e11d4
commit d800a98df0
1 changed files with 2 additions and 12 deletions

View File

@ -297,23 +297,13 @@ describe('Wallet model', function() {
it('call reconnect after interval', function(done) {
this.timeout(10000);
var w = createW2();
var testTime = 1000;
var callCount = 0;
var cT = w.reconnectDelay;
var t = 0;
do {
callCount++;
t += cT;
cT *= 2;
} while (t < testTime);
var spy = sinon.spy(w, 'scheduleConnect');
var callCount = 3;
w.netStart();
setTimeout(function() {
sinon.assert.callCount(spy, callCount);
done();
}, testTime);
}, w.reconnectDelay*callCount*(callCount+1)/2);
});
it('handle network indexes correctly', function() {