diff options
author | 2022-05-07 01:38:26 -0700 | |
---|---|---|
committer | 2022-05-07 01:38:26 -0700 | |
commit | bdf28e42f656c7abee7794be08752ae5ca9b8063 (patch) | |
tree | 128eb471ebb0d64918f30a9b0816b57dbe4ee467 /integration/bunjs-only-snippets/zlib.test.js | |
parent | 1687455a3fe22225bf18f97620d6d9b75c3e5a47 (diff) | |
download | bun-bdf28e42f656c7abee7794be08752ae5ca9b8063.tar.gz bun-bdf28e42f656c7abee7794be08752ae5ca9b8063.tar.zst bun-bdf28e42f656c7abee7794be08752ae5ca9b8063.zip |
[bun.js] Support `gzipSync`, `gunzipSync`, `inflateSync`, `deflateSync`
Diffstat (limited to 'integration/bunjs-only-snippets/zlib.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/zlib.test.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/zlib.test.js b/integration/bunjs-only-snippets/zlib.test.js new file mode 100644 index 000000000..64708529f --- /dev/null +++ b/integration/bunjs-only-snippets/zlib.test.js @@ -0,0 +1,18 @@ +import { describe, it, expect } from "bun:test"; +import { gzipSync, deflateSync, inflateSync, gunzipSync } from "bun"; + +describe("zlib", () => { + it("should be able to deflate and inflate", () => { + const data = new TextEncoder().encode("Hello World!".repeat(1)); + const compressed = deflateSync(data); + const decompressed = inflateSync(compressed); + expect(decompressed.join("")).toBe(data.join("")); + }); + + it("should be able to compress and decompress", () => { + const data = new TextEncoder().encode("Hello World!".repeat(1)); + const compressed = gzipSync(data); + const decompressed = gunzipSync(compressed); + expect(decompressed.join("")).toBe(data.join("")); + }); +}); |