Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Mock responses should fire when timers are mocked (#1336)
- Loading branch information
1 parent
556bb0d
commit a213169
Showing
5 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict' | ||
|
||
const nock = require('../.') | ||
const test = require('tap').test | ||
const request = require('request') | ||
const lolex = require('lolex') | ||
|
||
// https://github.com/nock/nock/issues/1334 | ||
test('one function returns successfully when fake timer is enabled', function(t) { | ||
const clock = lolex.install() | ||
nock('http://www.google.com') | ||
.get('/') | ||
.reply(200) | ||
|
||
request.get('http://www.google.com', function(err, resp) { | ||
clock.uninstall() | ||
if (err) { | ||
throw err | ||
} | ||
t.equal(resp.statusCode, 200) | ||
t.end() | ||
}) | ||
}) |