Skip to content
Browse files

recon test using tap

  • Loading branch information...
1 parent 9a5ca9c commit 9bb0c61d067fe76894bc2ca7950e19bf45362e0f @substack substack committed Nov 3, 2011
Showing with 9 additions and 10 deletions.
  1. +9 −10 test/recon.js
View
19 test/recon.js
@@ -1,7 +1,8 @@
var dnode = require('../');
-var assert = require('assert');
+var test = require('tap').test;
-exports.recon = function () {
+test('recon', function (t) {
+ t.plan(4);
var port = Math.floor(Math.random() * 40000 + 10000);
var scounts = { connect : 0, ready : 0 };
@@ -14,8 +15,6 @@ exports.recon = function () {
});
}).listen(port);
- var alive = true;
-
dnode(function (remote, conn) {
ccounts.connect ++;
conn.on('ready', function () {
@@ -33,13 +32,13 @@ exports.recon = function () {
}).connect(port, { reconnect : 100 });
setTimeout(function () {
- assert.ok(scounts.connect >= 2);
- assert.ok(scounts.ready >= 2);
+ t.ok(scounts.connect >= 2);
+ t.ok(scounts.ready >= 2);
- assert.eql(ccounts.connect, scounts.connect);
- assert.eql(ccounts.ready, scounts.ready);
+ t.equal(ccounts.connect, scounts.connect);
+ t.equal(ccounts.ready, scounts.ready);
server.close();
- alive = false;
+ t.end();
}, 1000);
-};
+});

0 comments on commit 9bb0c61

Please sign in to comment.
Something went wrong with that request. Please try again.