test: refactor error checks to use assert.ifError/mustSucceed · nodejs/node@f4722b1 · GitHub
Skip to content

Commit f4722b1

Browse files
KimSH39targos
authored andcommitted
test: refactor error checks to use assert.ifError/mustSucceed
Replace manual `if (err) assert.fail(err)` and `assert.ok(!err)` with `assert.ifError()` or `common.mustSucceed()` in a few tests to clarify intent and follow project conventions. - test/parallel/test-child-process-send-returns-boolean.js - test/parallel/test-dgram-blocklist.js - test/parallel/test-fs-watchfile.js PR-URL: #59424 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent b56d8af commit f4722b1

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

test/parallel/test-child-process-send-returns-boolean.js

Lines changed: 5 additions & 5 deletions

test/parallel/test-dgram-blocklist.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ const net = require('net');
4141
receiveSocket.bind(0, common.localhostIPv4, common.mustCall(() => {
4242
const addressInfo = receiveSocket.address();
4343
const client = dgram.createSocket('udp4');
44-
client.send('hello', addressInfo.port, addressInfo.address, common.mustCall((err) => {
45-
assert.ok(!err);
46-
client.close();
47-
}));
44+
client.send(
45+
'hello',
46+
addressInfo.port,
47+
addressInfo.address,
48+
common.mustSucceed(() => {
49+
client.close();
50+
})
51+
);
4852
}));
4953
}

test/parallel/test-fs-watchfile.js

Lines changed: 1 addition & 3 deletions

0 commit comments

Comments
 (0)