diff options
Diffstat (limited to 'cli/tests/unit_node')
-rw-r--r-- | cli/tests/unit_node/zlib_test.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/tests/unit_node/zlib_test.ts b/cli/tests/unit_node/zlib_test.ts index fa94493c1..b61cd4d4f 100644 --- a/cli/tests/unit_node/zlib_test.ts +++ b/cli/tests/unit_node/zlib_test.ts @@ -14,6 +14,8 @@ import { } from "node:zlib"; import { Buffer } from "node:buffer"; import { createReadStream, createWriteStream } from "node:fs"; +import { Readable } from "node:stream"; +import { buffer } from "node:stream/consumers"; Deno.test("brotli compression sync", () => { const buf = Buffer.from("hello world"); @@ -155,3 +157,16 @@ Deno.test("zlib compression with an encoded string", { const decompressed = unzipSync(compressed); assertEquals(decompressed.toString(), "hello world"); }); + +Deno.test("brotli large chunk size", async () => { + const input = new Uint8Array(1000000); + for (let i = 0; i < input.length; i++) { + input[i] = Math.random() * 256; + } + const output = await buffer( + Readable.from([input]) + .pipe(createBrotliCompress()) + .pipe(createBrotliDecompress()), + ); + assertEquals(output.length, input.length); +}); |