test: more common.mustNotCall in net, tls

PR-URL: https://github.com/nodejs/node/pull/57246
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
This commit is contained in:
Meghan Denny 2025-03-02 21:54:27 -08:00 committed by GitHub
parent 97cbefabd9
commit 208f07adda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 12 deletions

View File

@ -24,10 +24,8 @@ const common = require('../common');
const assert = require('assert');
const net = require('net');
const server1 = net.createServer(function(socket) {
});
const server2 = net.createServer(function(socket) {
});
const server1 = net.createServer(common.mustNotCall());
const server2 = net.createServer(common.mustNotCall());
server1.listen(0, common.mustCall(function() {
server2.on('error', function(error) {
assert.strictEqual(error.message.includes('EADDRINUSE'), true);

View File

@ -23,8 +23,7 @@
const common = require('../common');
const net = require('net');
const server = net.createServer(function(socket) {
});
const server = net.createServer(common.mustNotCall());
server.listen(0, common.mustNotCall());
server.on('error', common.mustNotCall());
server.close();

View File

@ -23,7 +23,6 @@
const common = require('../common');
const net = require('net');
const server = net.createServer(function(socket) {
});
const server = net.createServer(common.mustNotCall());
server.listen(1, '1.1.1.1', common.mustNotCall()); // EACCES or EADDRNOTAVAIL
server.on('error', common.mustCall());

View File

@ -11,8 +11,7 @@ const fixtures = require('../common/fixtures');
const server = tls.createServer({
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')
}, function(c) {
}).listen(0, common.mustCall(function() {
}, common.mustNotCall()).listen(0, common.mustCall(function() {
const c = tls.connect(this.address().port, common.mustNotCall());
c.on('error', common.mustCall());

View File

@ -14,8 +14,7 @@ const server = tls.createServer({
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem'),
rejectUnauthorized: true
}, function(c) {
}).listen(0, common.mustCall(function() {
}, common.mustNotCall()).listen(0, common.mustCall(function() {
assert.throws(() => {
tls.connect({
port: this.address().port,