File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,20 @@ describe("Brotli-wasm", () => {
60
60
expect ( textDecoder . decode ( result ) ) . to . equal ( 'Brotli brotli brotli brotli' ) ;
61
61
} ) ;
62
62
63
+ it ( "can compress and decompress data many times" , function ( ) {
64
+ this . timeout ( 10000 ) ; // Should only take 2-4 seconds, but leave some slack
65
+
66
+ const input = textEncoder . encode ( "Test input data" ) ;
67
+
68
+ for ( let i = 0 ; i < 500 ; i ++ ) {
69
+ const compressed = brotli . compress ( input ) ;
70
+ expect ( dataToBase64 ( compressed ) ) . to . equal ( 'Gw4A+KWpyubolCCjVAjmxJ4D' ) ;
71
+
72
+ const decompressed = brotli . decompress ( compressed ) ;
73
+ expect ( textDecoder . decode ( decompressed ) ) . to . equal ( 'Test input data' ) ;
74
+ }
75
+ } ) ;
76
+
63
77
it ( "cleanly fails when options is something other than an object" , ( ) => {
64
78
const input = textEncoder . encode ( "Test input data" ) ;
65
79
expect ( ( ) =>
You can’t perform that action at this time.
0 commit comments