Skip to content

Commit eb58e56

Browse files
committed
fixup! test: ensure assertions are reached on more tests
1 parent 1c28da6 commit eb58e56

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

test/parallel/test-net-autoselectfamily.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ if (common.hasIPv6) {
189189
socket.write('response-ipv4');
190190
socket.end();
191191
}));
192-
}));
192+
}, 0));
193193

194194
ipv4Server.listen(0, '127.0.0.1', common.mustCall(() => {
195195
const port = ipv4Server.address().port;

test/parallel/test-net-connect-options-fd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const CLIENT_VARIANTS = 6; // Same length as array above
7272
assert.fail(`[Pipe server]${err}`);
7373
})
7474
.listen({ path: serverPath }, common.mustCall(function serverOnListen() {
75-
const getSocketOpt = common.mustCall((index) => {
75+
const getSocketOpt = common.mustCallAtLeast((index) => {
7676
const handle = new Pipe(PipeConstants.SOCKET);
7777
const err = handle.bind(`${prefix}-client-${socketCounter++}`);
7878
assert(err >= 0, String(err));
@@ -84,7 +84,7 @@ const CLIENT_VARIANTS = 6; // Same length as array above
8484
const getConnectOpt = () => ({
8585
path: serverPath
8686
});
87-
const getConnectCb = common.mustCall((index) => common.mustCall(function clientOnConnect() {
87+
const getConnectCb = common.mustCallAtLeast((index) => common.mustCall(function clientOnConnect() {
8888
// Test if it's wrapping an existing fd
8989
assert(handleMap.has(index));
9090
const oldHandle = handleMap.get(index);

test/parallel/test-net-onread-static-buffer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ net.createServer(common.mustCall(function(socket) {
4141
port: this.address().port,
4242
onread: {
4343
buffer: sockBuf,
44-
callback: common.mustCall(function(nread, buf) {
44+
callback: common.mustCallAtLeast(function(nread, buf) {
4545
assert.strictEqual(buf, sockBuf);
4646
received += nread;
4747
const newIncoming = new Uint8Array(incoming.length + nread);
@@ -74,7 +74,7 @@ net.createServer(common.mustCall(function(socket) {
7474
bufPoolIdx = (bufPoolIdx + 1) % bufPool.length;
7575
return bufPool[bufPoolIdx];
7676
},
77-
callback: common.mustCall(function(nread, buf) {
77+
callback: common.mustCallAtLeast(function(nread, buf) {
7878
assert.strictEqual(buf, bufPool[bufPoolIdx]);
7979
received += nread;
8080
incoming.push(Buffer.from(buf.slice(0, nread)));
@@ -105,7 +105,7 @@ net.createServer(common.mustCall(function(socket) {
105105
bufPoolIdx = (bufPoolIdx + 1) % bufPool.length;
106106
return bufPool[bufPoolIdx];
107107
},
108-
callback: common.mustCall(function(nread, buf) {
108+
callback: common.mustCallAtLeast(function(nread, buf) {
109109
assert.strictEqual(buf, bufPool[bufPoolIdx]);
110110
received += nread;
111111
const newIncoming = new Uint8Array(incoming.length + nread);
@@ -134,7 +134,7 @@ net.createServer(common.mustCall(function(socket) {
134134
port: this.address().port,
135135
onread: {
136136
buffer: sockBuf,
137-
callback: common.mustCall(function(nread, buf) {
137+
callback: common.mustCallAtLeast(function(nread, buf) {
138138
assert.strictEqual(paused, false);
139139
assert.strictEqual(buf, sockBuf);
140140
received += nread;
@@ -166,7 +166,7 @@ net.createServer(common.mustCall(function(socket) {
166166
port: this.address().port,
167167
onread: {
168168
buffer: sockBuf,
169-
callback: common.mustCall(function(nread, buf) {
169+
callback: common.mustCallAtLeast(function(nread, buf) {
170170
assert.strictEqual(paused, false);
171171
assert.strictEqual(buf, sockBuf);
172172
received += nread;

test/parallel/test-net-pipe-with-long-path.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ const pipePath = `${tmpdir.path}/${'x'.repeat(10000)}.sock`;
1919
const server = net.createServer()
2020
.listen(pipePath)
2121
// It may work on some operating systems
22-
.on('listening', common.mustCall(() => {
22+
.on('listening', common.mustCallAtLeast(() => {
2323
// The socket file must exist
2424
assert.ok(fs.existsSync(pipePath));
2525
const socket = net.connect(pipePath, common.mustCall(() => {
2626
socket.destroy();
2727
server.close();
2828
}));
29-
}))
29+
}, 0))
3030
.on('error', common.mustCall((error) => {
3131
assert.ok(error.code === 'EINVAL', error.message);
3232
net.connect(pipePath)

test/parallel/test-net-reconnect.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ server.listen(0, common.mustCall(function() {
5858
console.error('CLIENT connected', client._writableState);
5959
});
6060

61-
client.on('data', common.mustCall((chunk) => {
61+
client.on('data', common.mustCallAtLeast((chunk) => {
6262
client_recv_count += 1;
6363
console.log(`client_recv_count ${client_recv_count}`);
6464
assert.strictEqual(chunk, 'hello\r\n');
@@ -71,7 +71,7 @@ server.listen(0, common.mustCall(function() {
7171
client_end_count++;
7272
});
7373

74-
client.on('close', common.mustCall((had_error) => {
74+
client.on('close', common.mustCallAtLeast((had_error) => {
7575
console.log('CLIENT disconnect');
7676
assert.strictEqual(had_error, false);
7777
if (disconnect_count++ < N)

0 commit comments

Comments
 (0)