@@ -49,7 +49,7 @@ const bufferSourceChunksForDeflate = [
4949} ,
5050{
5151name : 'Float16Array' ,
52- value : new Float16Array ( new Uint8Array ( compressedBytesWithDeflate ) . buffer )
52+ value : ( ) => new Float16Array ( new Uint8Array ( compressedBytesWithDeflate ) . buffer )
5353} ,
5454{
5555name : 'Float32Array' ,
@@ -100,7 +100,7 @@ const bufferSourceChunksForGzip = [
100100} ,
101101{
102102name : 'Float16Array' ,
103- value : new Float16Array ( new Uint8Array ( compressedBytesWithGzip ) . buffer )
103+ value : ( ) => new Float16Array ( new Uint8Array ( compressedBytesWithGzip ) . buffer )
104104} ,
105105{
106106name : 'Float32Array' ,
@@ -151,7 +151,7 @@ const bufferSourceChunksForDeflateRaw = [
151151} ,
152152{
153153name : 'Float16Array' ,
154- value : new Float16Array ( new Uint8Array ( compressedBytesWithDeflateRaw ) . buffer )
154+ value : ( ) => new Float16Array ( new Uint8Array ( compressedBytesWithDeflateRaw ) . buffer )
155155} ,
156156{
157157name : 'Float32Array' ,
@@ -172,7 +172,7 @@ for (const chunk of bufferSourceChunksForDeflate) {
172172const ds = new DecompressionStream ( 'deflate' ) ;
173173const reader = ds . readable . getReader ( ) ;
174174const writer = ds . writable . getWriter ( ) ;
175- const writePromise = writer . write ( chunk . value ) ;
175+ const writePromise = writer . write ( typeof chunk . value === 'function' ? chunk . value ( ) : chunk . value ) ;
176176writer . close ( ) ;
177177const { value } = await reader . read ( ) ;
178178assert_array_equals ( Array . from ( value ) , deflateExpectedChunkValue , 'value should match' ) ;
@@ -184,7 +184,7 @@ for (const chunk of bufferSourceChunksForGzip) {
184184const ds = new DecompressionStream ( 'gzip' ) ;
185185const reader = ds . readable . getReader ( ) ;
186186const writer = ds . writable . getWriter ( ) ;
187- const writePromise = writer . write ( chunk . value ) ;
187+ const writePromise = writer . write ( typeof chunk . value === 'function' ? chunk . value ( ) : chunk . value ) ;
188188writer . close ( ) ;
189189const { value } = await reader . read ( ) ;
190190assert_array_equals ( Array . from ( value ) , gzipExpectedChunkValue , 'value should match' ) ;
@@ -196,7 +196,7 @@ for (const chunk of bufferSourceChunksForDeflateRaw) {
196196const ds = new DecompressionStream ( 'deflate-raw' ) ;
197197const reader = ds . readable . getReader ( ) ;
198198const writer = ds . writable . getWriter ( ) ;
199- const writePromise = writer . write ( chunk . value ) ;
199+ const writePromise = writer . write ( typeof chunk . value === 'function' ? chunk . value ( ) : chunk . value ) ;
200200writer . close ( ) ;
201201const { value } = await reader . read ( ) ;
202202assert_array_equals ( Array . from ( value ) , deflateRawExpectedChunkValue , 'value should match' ) ;
0 commit comments