Skip to content

Commit

Permalink
refactor(httpsMock): silly refactoring... a matter of style
Browse files Browse the repository at this point in the history
  • Loading branch information
lupomontero committed Jul 3, 2019
1 parent 8487d68 commit 62d7c58
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions __mocks__/https.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ exports.request = jest.fn().mockImplementation(() => {
const req = new Request();
const result = mockResponses.shift();

if (result instanceof Error) {
setTimeout(() => req.emit('error', result), 0);
} else {
setTimeout(() => req.emit('response', new Response(result)), 0);
}
setTimeout(() => (
(result instanceof Error)
? req.emit('error', result)
: req.emit('response', new Response(result))
), 0);

return req;
});
Expand Down

0 comments on commit 62d7c58

Please sign in to comment.