test: use mustSucceed in test-fs-read

This commit refactors the callback in test/parallel/test-fs-read.js
to use common.mustSucceed() instead of common.mustCall().

common.mustSucceed() is the preferred helper for standard error-first
callbacks that are expected to succeed, as it provides an explicit
check that the `err` argument is null. This improves the clarity
and robustness of the test.

PR-URL: https://github.com/nodejs/node/pull/59204
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Sungwon 2025-07-27 13:54:22 +09:00 committed by GitHub
parent 7232f09995
commit 3b574436ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,7 @@ const fd = fs.openSync(filepath, 'r');
const bufferAsync = Buffer.alloc(0);
const bufferSync = Buffer.alloc(0);
fs.read(fd, bufferAsync, 0, 0, 0, common.mustCall((err, bytesRead) => {
fs.read(fd, bufferAsync, 0, 0, 0, common.mustSucceed((bytesRead) => {
assert.strictEqual(bytesRead, 0);
assert.deepStrictEqual(bufferAsync, Buffer.alloc(0));
}));