From add181c53e73a17b733b936881e9d409ced12fc8 Mon Sep 17 00:00:00 2001 From: Rob Richardson Date: Thu, 1 May 2014 10:39:30 -0700 Subject: [PATCH] Restler reports different behavior on different platforms when the target server doesn't exist (isn't running). On win32, this test passes. On non-win32, this test fails. See https://gist.github.com/robrich/74bff4b51358a3470160 for similar experiments on native http.request --- test/restler.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/restler.js b/test/restler.js index 43b5320..fa1e707 100644 --- a/test/restler.js +++ b/test/restler.js @@ -728,3 +728,20 @@ module.exports['Timeout'] = { }); } }; + +module.exports['MissingServer'] = { + // no setUp or tearDown: the server isn't running + + 'will timeout within given time': function(test) { + rest.get(host + '/timeout', {timeout: 50}) + .on('timeout', function () { + test.ok(true, 'timeout endpoint is 100ms and timeout was 50ms'); + test.done(); + }) + .on('complete', function () { + test.ok(err.code === 'ECONNREFUSED', 'timeout is reported as ECONNREFUSED'); + test.ok(false, 'should not emit complete event'); + test.done(); + }); + } +};