@@ -49,7 +49,7 @@ const bufferSourceChunksForDeflate = [
49
49
} ,
50
50
{
51
51
name : 'Float16Array' ,
52
- value : new Float16Array ( new Uint8Array ( compressedBytesWithDeflate ) . buffer )
52
+ value : ( ) => new Float16Array ( new Uint8Array ( compressedBytesWithDeflate ) . buffer )
53
53
} ,
54
54
{
55
55
name : 'Float32Array' ,
@@ -100,7 +100,7 @@ const bufferSourceChunksForGzip = [
100
100
} ,
101
101
{
102
102
name : 'Float16Array' ,
103
- value : new Float16Array ( new Uint8Array ( compressedBytesWithGzip ) . buffer )
103
+ value : ( ) => new Float16Array ( new Uint8Array ( compressedBytesWithGzip ) . buffer )
104
104
} ,
105
105
{
106
106
name : 'Float32Array' ,
@@ -151,7 +151,7 @@ const bufferSourceChunksForDeflateRaw = [
151
151
} ,
152
152
{
153
153
name : 'Float16Array' ,
154
- value : new Float16Array ( new Uint8Array ( compressedBytesWithDeflateRaw ) . buffer )
154
+ value : ( ) => new Float16Array ( new Uint8Array ( compressedBytesWithDeflateRaw ) . buffer )
155
155
} ,
156
156
{
157
157
name : 'Float32Array' ,
@@ -172,7 +172,7 @@ for (const chunk of bufferSourceChunksForDeflate) {
172
172
const ds = new DecompressionStream ( 'deflate' ) ;
173
173
const reader = ds . readable . getReader ( ) ;
174
174
const writer = ds . writable . getWriter ( ) ;
175
- const writePromise = writer . write ( chunk . value ) ;
175
+ const writePromise = writer . write ( typeof chunk . value === 'function' ? chunk . value ( ) : chunk . value ) ;
176
176
writer . close ( ) ;
177
177
const { value } = await reader . read ( ) ;
178
178
assert_array_equals ( Array . from ( value ) , deflateExpectedChunkValue , 'value should match' ) ;
@@ -184,7 +184,7 @@ for (const chunk of bufferSourceChunksForGzip) {
184
184
const ds = new DecompressionStream ( 'gzip' ) ;
185
185
const reader = ds . readable . getReader ( ) ;
186
186
const writer = ds . writable . getWriter ( ) ;
187
- const writePromise = writer . write ( chunk . value ) ;
187
+ const writePromise = writer . write ( typeof chunk . value === 'function' ? chunk . value ( ) : chunk . value ) ;
188
188
writer . close ( ) ;
189
189
const { value } = await reader . read ( ) ;
190
190
assert_array_equals ( Array . from ( value ) , gzipExpectedChunkValue , 'value should match' ) ;
@@ -196,7 +196,7 @@ for (const chunk of bufferSourceChunksForDeflateRaw) {
196
196
const ds = new DecompressionStream ( 'deflate-raw' ) ;
197
197
const reader = ds . readable . getReader ( ) ;
198
198
const writer = ds . writable . getWriter ( ) ;
199
- const writePromise = writer . write ( chunk . value ) ;
199
+ const writePromise = writer . write ( typeof chunk . value === 'function' ? chunk . value ( ) : chunk . value ) ;
200
200
writer . close ( ) ;
201
201
const { value } = await reader . read ( ) ;
202
202
assert_array_equals ( Array . from ( value ) , deflateRawExpectedChunkValue , 'value should match' ) ;
0 commit comments