mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01: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
|
|
@ -8,7 +8,7 @@ const fd = fs.openSync(filepath, 'r');
|
||||||
const bufferAsync = Buffer.alloc(0);
|
const bufferAsync = Buffer.alloc(0);
|
||||||
const bufferSync = 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.strictEqual(bytesRead, 0);
|
||||||
assert.deepStrictEqual(bufferAsync, Buffer.alloc(0));
|
assert.deepStrictEqual(bufferAsync, Buffer.alloc(0));
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user