mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test: improve test-internal-fs-syncwritestream
A subtest about the behavior when `autoClose=false`. PR-URL: https://github.com/nodejs/node/pull/54671 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
3569493ba7
commit
415905712e
@ -66,6 +66,18 @@ const filename = tmpdir.resolve('sync-write-stream.txt');
|
||||
assert.strictEqual(stream.fd, null);
|
||||
}
|
||||
|
||||
// Verify that the file is not closed when autoClose=false
|
||||
{
|
||||
const fd = fs.openSync(filename, 'w');
|
||||
const stream = new SyncWriteStream(fd, { autoClose: false });
|
||||
|
||||
stream.on('close', common.mustCall());
|
||||
|
||||
assert.strictEqual(stream.destroy(), stream);
|
||||
fs.fstatSync(fd); // Does not throw
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
|
||||
// Verify that calling end() will also destroy the stream.
|
||||
{
|
||||
const fd = fs.openSync(filename, 'w');
|
||||
|
Loading…
Reference in New Issue
Block a user