Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup: test
  • Loading branch information
ronag committed Mar 10, 2020
commit 6ce7477d658bcb23e0fb08c1bddd0fcbdc0b9595
13 changes: 2 additions & 11 deletions test/parallel/test-http-client-set-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Test that the `'timeout'` event is emitted exactly once if the `timeout`
// option and `request.setTimeout()` are used together.

const { expectsError, mustCall } = require('../common');
const { mustNotCall, mustCall } = require('../common');
const { strictEqual } = require('assert');
const { createServer, get } = require('http');

Expand Down Expand Up @@ -31,18 +31,9 @@ server.listen(0, mustCall(() => {
}));
}));

req.on('error', expectsError({
name: 'Error',
code: 'ECONNRESET',
message: 'socket hang up'
}));
req.on('error', mustNotCall());

req.on('close', mustCall(() => {
server.close();
}));

req.on('timeout', mustCall(() => {
strictEqual(req.socket.listenerCount('timeout'), 1);
req.destroy();
}));
}));
6 changes: 1 addition & 5 deletions test/parallel/test-https-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ const server = https.createServer(options, function() {
console.log('got response');
});

req.on('error', common.expectsError({
message: 'socket hang up',
code: 'ECONNRESET',
name: 'Error'
}));
req.on('error', common.mustNotCall());

req.on('timeout', common.mustCall(function() {
console.log('timeout occurred outside');
Expand Down