mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
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:
parent
7232f09995
commit
3b574436ed
1 changed files with 1 additions and 1 deletions
|
@ -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));
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue