Skip to content
Browse files

simple test using tap

  • Loading branch information...
1 parent de1ab08 commit b2e69af888784568fab2057e55c03291db2344f0 @substack committed Nov 3, 2011
Showing with 12 additions and 10 deletions.
  1. +12 −10 test/simple.js
View
22 test/simple.js
@@ -1,37 +1,39 @@
var dnode = require('../');
-var assert = require('assert');
+var test = require('tap').test;
-exports.simple = function () {
+test('simple', function (t) {
+ t.plan(7);
var port = Math.floor(Math.random() * 40000 + 10000);
var server = dnode({
timesTen : function (n,reply) {
- assert.equal(n, 50);
+ t.equal(n, 50);
reply(n * 10);
},
moo : function (reply) { reply(100) },
sTimesTen : function (n, cb) {
- assert.equal(n, 5);
+ t.equal(n, 5);
cb(n * 10);
},
}).listen(port.toString()); // test for stringified ports too why not
server.on('ready', function () {
dnode.connect(port, function (remote, conn) {
- assert.ok(conn.id);
- assert.equal(conn.stream.remoteAddress, '127.0.0.1');
+ t.ok(conn.id);
+ t.equal(conn.stream.remoteAddress, '127.0.0.1');
remote.moo(function (x) {
- assert.equal(x, 100, 'remote moo == 100');
+ t.equal(x, 100, 'remote moo == 100');
});
remote.sTimesTen(5, function (m) {
- assert.equal(m, 50, '5 * 10 == 50');
+ t.equal(m, 50, '5 * 10 == 50');
remote.timesTen(m, function (n) {
- assert.equal(n, 500, '50 * 10 == 500');
+ t.equal(n, 500, '50 * 10 == 500');
conn.end();
server.close();
+ t.end();
});
});
});
});
-};
+});

0 comments on commit b2e69af

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