From feba133711d0ab79528134d05f1e38168305adfc Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sun, 11 Aug 2024 01:56:30 -0700 Subject: fix(ext/node): createBrotliCompress params (#24984) Fixes https://github.com/denoland/deno/issues/24416 --- tests/unit_node/zlib_test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') 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); +}); -- cgit v1.2.3