Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: move test from syncwritestream to write-stream
  • Loading branch information
styfle committed Dec 21, 2017
commit a76b9f1ad95624294e1b2116d6c4ee21ae51320d
13 changes: 13 additions & 0 deletions test/parallel/test-fs-write-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,16 @@ common.refreshTmpDir();
});
stream.destroy();
}

// Throws if data is not of type Buffer.
{
const stream = fs.createWriteStream(file);
common.expectsError(() => {
stream._write(42, null, function() {});
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "data" argument must be of type Buffer. Received type number'
});
stream.destroy();
}
12 changes: 0 additions & 12 deletions test/parallel/test-internal-fs-syncwritestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ const filename = path.join(common.tmpDir, 'sync-write-stream.txt');
assert.strictEqual(fs.readFileSync(filename).equals(chunk), true);
}

// Throws if data is not of type Buffer.
{
const stream = new SyncWriteStream(1);
common.expectsError(() => {
stream._write(42, null, function() {});
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "data" argument must be of type Buffer. Received type number'
});
}

// Verify that the stream will unset the fd after destroy().
{
const fd = fs.openSync(filename, 'w');
Expand Down