summaryrefslogtreecommitdiff
path: root/tests/unit_node/zlib_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_node/zlib_test.ts')
-rw-r--r--tests/unit_node/zlib_test.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unit_node/zlib_test.ts b/tests/unit_node/zlib_test.ts
index 8bce5ce7d..0eff95445 100644
--- a/tests/unit_node/zlib_test.ts
+++ b/tests/unit_node/zlib_test.ts
@@ -10,6 +10,7 @@ import {
createBrotliCompress,
createBrotliDecompress,
createDeflate,
+ gzip,
gzipSync,
unzipSync,
} from "node:zlib";
@@ -210,3 +211,17 @@ Deno.test("createBrotliCompress params", async () => {
);
assertEquals(output.length, input.length);
});
+
+Deno.test("gzip() and gzipSync() accept ArrayBuffer", async () => {
+ const deffered = Promise.withResolvers<void>();
+ const buf = new ArrayBuffer(0);
+ let output: Buffer;
+ gzip(buf, (_err, data) => {
+ output = data;
+ deffered.resolve();
+ });
+ await deffered.promise;
+ assert(output! instanceof Buffer);
+ const outputSync = gzipSync(buf);
+ assert(outputSync instanceof Buffer);
+});