File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,19 @@ describe("Brotli-wasm", () => {
206
206
expect ( Buffer . from ( brotli . decompress ( output ) ) . toString ( 'base64' ) ) . to . equal ( input . toString ( 'base64' ) ) ;
207
207
} ) ;
208
208
209
+ it ( "streaming compressing can handle needing more output when action is finish" , ( ) => {
210
+ const input = Buffer . from ( 'Some thrilling text I urgently need to compress' ) ;
211
+ const stream = new brotli . CompressStream ( ) ;
212
+ const output1 = stream . compress ( input , 1 ) ;
213
+ expect ( stream . result ( ) ) . to . equal ( brotli . BrotliStreamResult . NeedsMoreInput ) ;
214
+ const output2 = stream . compress ( undefined , 1 ) ;
215
+ expect ( stream . result ( ) ) . to . equal ( brotli . BrotliStreamResult . NeedsMoreOutput ) ;
216
+ const output3 = stream . compress ( undefined , 100 ) ;
217
+ expect ( stream . result ( ) ) . to . equal ( brotli . BrotliStreamResult . ResultSuccess ) ;
218
+ const output = Buffer . concat ( [ output1 , output2 , output3 ] ) ;
219
+ expect ( Buffer . from ( brotli . decompress ( output ) ) . toString ( 'base64' ) ) . to . equal ( input . toString ( 'base64' ) ) ;
220
+ } ) ;
221
+
209
222
it ( "streaming decompressing can handle needing more output" , ( ) => {
210
223
const input = Buffer . from ( 'GxoAABypU587dC0k9ianQOgqjS32iUTcCA==' , 'base64' ) ;
211
224
const stream = new brotli . DecompressStream ( ) ;
You can’t perform that action at this time.
0 commit comments