File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -165,3 +165,35 @@ class TestWritable extends Writable {
165165 const writer = writableStream . getWriter ( ) ;
166166 writer . closed . then ( common . mustCall ( ) ) ;
167167}
168+
169+ {
170+ const duplex = new PassThrough ( ) ;
171+ const writableStream = newWritableStreamFromStreamWritable ( duplex ) ;
172+ const ec = new TextEncoder ( ) ;
173+ const arrayBuffer = ec . encode ( 'hello' ) . buffer ;
174+ writableStream
175+ . getWriter ( )
176+ . write ( arrayBuffer )
177+ . then ( common . mustCall ( ) ) ;
178+
179+ duplex . on ( 'data' , common . mustCall ( ( chunk ) => {
180+ assert ( chunk instanceof Buffer ) ;
181+ assert ( chunk . equals ( Buffer . from ( 'hello' ) ) ) ;
182+ } ) ) ;
183+ }
184+
185+ {
186+ const duplex = new PassThrough ( { objectMode : true } ) ;
187+ const writableStream = newWritableStreamFromStreamWritable ( duplex ) ;
188+ const ec = new TextEncoder ( ) ;
189+ const arrayBuffer = ec . encode ( 'hello' ) . buffer ;
190+ writableStream
191+ . getWriter ( )
192+ . write ( arrayBuffer )
193+ . then ( common . mustCall ( ) ) ;
194+
195+ duplex . on ( 'data' , common . mustCall ( ( chunk ) => {
196+ assert ( chunk instanceof ArrayBuffer ) ;
197+ assert . strictEqual ( chunk , arrayBuffer ) ;
198+ } ) ) ;
199+ }
You can’t perform that action at this time.
0 commit comments