test: add mustCallAtLeast to test-fs-read-stream-fd test
PR-URL: https://github.com/nodejs/node/pull/27461 Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
274364580a
commit
4cf8b4212c
@ -20,7 +20,7 @@
|
|||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
@ -35,9 +35,9 @@ fs.writeFileSync(file, input);
|
|||||||
const fd = fs.openSync(file, 'r');
|
const fd = fs.openSync(file, 'r');
|
||||||
const stream = fs.createReadStream(null, { fd: fd, encoding: 'utf8' });
|
const stream = fs.createReadStream(null, { fd: fd, encoding: 'utf8' });
|
||||||
|
|
||||||
stream.on('data', (data) => {
|
stream.on('data', common.mustCallAtLeast((data) => {
|
||||||
output += data;
|
output += data;
|
||||||
});
|
}));
|
||||||
|
|
||||||
process.on('exit', () => {
|
process.on('exit', () => {
|
||||||
assert.strictEqual(output, input);
|
assert.strictEqual(output, input);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user