Skip to content

Commit

Permalink
Add test for delay/timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
vrinek committed Nov 23, 2016
1 parent 07ffed0 commit 65373a9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_timeout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

var nock = require('../.');
var test = require('tap').test;
var request = require('request');

test('something', function (t) {
nock('http://google.com')
.get('/')
.delay(1000)
.reply(200, {});

request({
url: 'http://google.com',
timeout: 10
}, function (err, response) {
t.ok(err);
t.equal(err.code, 'ETIMEDOUT')
t.end();
});
});

0 comments on commit 65373a9

Please sign in to comment.