-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stream: fix sizeAlgorithm validation in WritableStream
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com> PR-URL: #57280 Fixes: #57272 Refs: #56067 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: Jason Zhang <xzha4350@gmail.com>
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const { test } = require('node:test'); | ||
const assert = require('node:assert'); | ||
|
||
// https://github.com/nodejs/node/issues/57272 | ||
|
||
test('should throw error when writing after close', async (t) => { | ||
const writable = new WritableStream({ | ||
write(chunk) { | ||
console.log(chunk); | ||
}, | ||
}); | ||
|
||
const writer = writable.getWriter(); | ||
|
||
await writer.write('Hello'); | ||
await writer.close(); | ||
|
||
await assert.rejects( | ||
async () => { | ||
await writer.write('World'); | ||
}, | ||
{ | ||
name: 'TypeError', | ||
} | ||
); | ||
}); |