diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit_node/zlib_test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/tests/unit_node/zlib_test.ts b/cli/tests/unit_node/zlib_test.ts index fc9eaeb5b..957c7cdfc 100644 --- a/cli/tests/unit_node/zlib_test.ts +++ b/cli/tests/unit_node/zlib_test.ts @@ -96,3 +96,19 @@ Deno.test( handle.destroy(); }, ); + +Deno.test("should work with dataview", () => { + const buf = Buffer.from("hello world"); + const compressed = brotliCompressSync(new DataView(buf.buffer)); + const decompressed = brotliDecompressSync(compressed); + assertEquals(decompressed.toString(), "hello world"); +}); + +Deno.test("should work with a buffer from an encoded string", () => { + const encoder = new TextEncoder(); + const buffer = encoder.encode("hello world"); + const buf = Buffer.from(buffer); + const compressed = brotliCompressSync(buf); + const decompressed = brotliDecompressSync(compressed); + assertEquals(decompressed.toString(), "hello world"); +}); |