Permalink
Browse files

stream test using tap

  • Loading branch information...
1 parent 06ef6b8 commit f0d258fd8290c7a24fb99c4290c359e906a1b243 @substack committed Nov 3, 2011
Showing with 6 additions and 9 deletions.
  1. +6 −9 test/stream.js
View
@@ -1,8 +1,9 @@
-var assert = require('assert');
var dnode = require('../');
var net = require('net');
+var test = require('tap').test;
-exports.stream = function () {
+test('stream', function (t) {
+ t.plan(1);
var port = Math.floor(Math.random() * 40000 + 10000);
var server = dnode({
@@ -12,21 +13,17 @@ exports.stream = function () {
var netServer = net.createServer();
server.listen(netServer);
- var to = setTimeout(function () {
- assert.fail();
- }, 5000);
-
var times = 0;
netServer.listen(port, function () {
var netClient = net.createConnection(port);
dnode.connect(netClient, function (remote) {
remote.meow(function (cats) {
- clearTimeout(to);
- assert.equal(cats, 'cats');
+ t.equal(cats, 'cats');
netClient.end();
netServer.close();
+ t.end();
});
});
});
-};
+});

0 comments on commit f0d258f

Please sign in to comment.