From b82a2f114c7c936bf4398669453513ace478cb1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 2 Aug 2024 15:44:32 +0100 Subject: fix(ext/node): node:zlib coerces quality 10 to 9.5 (#24850) Fixes https://github.com/denoland/deno/issues/24572 --- tests/unit_node/zlib_test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/unit_node/zlib_test.ts b/tests/unit_node/zlib_test.ts index 215717dde..eb248c34d 100644 --- a/tests/unit_node/zlib_test.ts +++ b/tests/unit_node/zlib_test.ts @@ -6,6 +6,7 @@ import { brotliCompress, brotliCompressSync, brotliDecompressSync, + constants, createBrotliCompress, createBrotliDecompress, createDeflate, @@ -137,6 +138,19 @@ Deno.test("should work with a buffer from an encoded string", () => { assertEquals(decompressed.toString(), "hello world"); }); +// https://github.com/denoland/deno/issues/24572 +Deno.test("Brotli quality 10 doesn't panic", () => { + const e = brotliCompressSync("abc", { + params: { + [constants.BROTLI_PARAM_QUALITY]: 10, + }, + }); + assertEquals( + new Uint8Array(e.buffer), + new Uint8Array([11, 1, 128, 97, 98, 99, 3]), + ); +}); + Deno.test( "zlib compression with dataview", () => { -- cgit v1.2.3