diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-08-11 01:56:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-11 14:26:30 +0530 |
commit | feba133711d0ab79528134d05f1e38168305adfc (patch) | |
tree | 13e3a5de54d716693492e91eb41bd88613a0593f /tests/unit_node/zlib_test.ts | |
parent | 82884348cb1b424a4c4452ef734bc4e760926b2f (diff) |
fix(ext/node): createBrotliCompress params (#24984)
Fixes https://github.com/denoland/deno/issues/24416
Diffstat (limited to 'tests/unit_node/zlib_test.ts')
-rw-r--r-- | tests/unit_node/zlib_test.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/unit_node/zlib_test.ts b/tests/unit_node/zlib_test.ts index eb248c34d..8bce5ce7d 100644 --- a/tests/unit_node/zlib_test.ts +++ b/tests/unit_node/zlib_test.ts @@ -191,3 +191,22 @@ Deno.test("brotli decompress flush restore size", async () => { ); assertEquals(output.length, input.length); }); + +Deno.test("createBrotliCompress params", async () => { + const compress = createBrotliCompress({ + params: { + [constants.BROTLI_PARAM_QUALITY]: 11, + }, + }); + + const input = new Uint8Array(10000); + for (let i = 0; i < input.length; i++) { + input[i] = Math.random() * 256; + } + const output = await buffer( + Readable.from([input]) + .pipe(compress) + .pipe(createBrotliDecompress()), + ); + assertEquals(output.length, input.length); +}); |