diff --git a/test/common/connection.js b/test/common/connection.js index 24669c94145..8087774ce16 100644 --- a/test/common/connection.js +++ b/test/common/connection.js @@ -62,7 +62,7 @@ describe('Connection', function() { c.requester = function(opts, callback) { callback(null); }; - c.req({ uri: 'https://someuri' }, function(){}); + c.req({ uri: 'https://someuri' }, function() {}); }); it('should make other requests wait while connecting', function(done) { @@ -74,9 +74,9 @@ describe('Connection', function() { }); c.fetchToken = function(cb) { numTokenFetches++; - setTimeout(function() { + setImmediate(function() { cb(null, tokenNeverExpires); - }, 100); + }); }; c.requester = function(opts, callback) { callback(null); @@ -107,7 +107,7 @@ describe('Connection', function() { c.requester = function(opts, callback) { callback(null); }; - c.req({ uri: 'https://someuri' }, function(){}); + c.req({ uri: 'https://someuri' }, function() {}); }); }); }); diff --git a/test/pubsub/index.js b/test/pubsub/index.js index 8b54dd8523c..1da254d1e5e 100644 --- a/test/pubsub/index.js +++ b/test/pubsub/index.js @@ -59,12 +59,8 @@ describe('Subscription', function() { } }; var sub = conn.subscribe('sub1', { autoAck: false }); - var doneCalled = false; sub.on('message', function() { - if (!doneCalled) { - done(); - } - doneCalled = true; + done(); }); }); @@ -78,9 +74,9 @@ describe('Subscription', function() { callback(null, {}); return; case 'subscriptions/pull': - setTimeout(function() { + setImmediate(function() { callback(null, { ackId: 123 }); - }, 500); + }); return; case 'subscriptions/acknowledge': callback(null, true); @@ -88,12 +84,8 @@ describe('Subscription', function() { } }; var sub = conn.subscribe('sub1', { autoAck: true }); - var doneCalled = false; sub.on('message', function() { - if (!doneCalled) { - done(); - } - doneCalled = true; + done(); }); }); });