Skip to content

Commit

Permalink
Added failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg authored and tj committed Dec 28, 2010
1 parent 9fd017f commit ccbdcf0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/http.test.js
Expand Up @@ -32,6 +32,19 @@ var server = http.createServer(function(req, res){
}
});

var delayedServer = http.createServer(function(req, res){
res.writeHead(200);
res.end('it worked');
});

var oldListen = delayedServer.listen;
delayedServer.listen = function(){
var args = arguments;
setTimeout(function(){
oldListen.apply(delayedServer, args);
}, 100);
};

module.exports = {
'test assert.response()': function(beforeExit){
var called = 0;
Expand Down Expand Up @@ -85,5 +98,12 @@ module.exports = {
assert.response(server,
{ url: '/' },
{ body: '{"name":"tj"}', headers: { 'Content-Type': /^application\/json/ } });
},

// [!] if this test doesn't pass, an uncaught ECONNREFUSED will display
'test assert.response() with deferred listen()': function(){
assert.response(delayedServer,
{ url: '/' },
{ body: 'it worked' });
}
};

0 comments on commit ccbdcf0

Please sign in to comment.