Permalink
Browse files

half open test now fails when the request doesn't come all on the fir…

…st tick
  • Loading branch information...
1 parent b1bedf1 commit a62d0ee386deee5f240f7d60c382ec84bdf22ef9 @substack committed Dec 17, 2012
Showing with 14 additions and 4 deletions.
  1. +14 −4 test/half_open.js
View
@@ -15,7 +15,11 @@ var proxy = bouncy(function (req, res, bounce) {
proxy.listen(0);
var server = http.createServer(function (req, res) {
- res.end('beep boop\n');
+ res.write('beep ');
+
+ setTimeout(function () {
+ res.end('boop.');
+ }, 100);
});
server.listen(0);
@@ -27,9 +31,15 @@ test('half-open', function (t) {
c.on('data', function (buf) { data += buf });
c.on('end', function () {
var lines = data.split(/\r?\n/);
- t.ok(lines.some(function (line) {
- return line === 'beep boop';
- }));
+ for (var ix = 0; lines[ix] !== ''; ix++);
+
+ t.same(lines.slice(ix), [
+ '5',
+ 'beep ',
+ '5',
+ 'boop.',
+ '0'
+ ]);
});
c.end([

0 comments on commit a62d0ee

Please sign in to comment.