diff options
author | Florian Dold <florian@dold.me> | 2021-08-20 13:31:03 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-08-20 13:31:03 +0200 |
commit | 859a8734c87d5e5081d7b0aa02cb538a7c801eac (patch) | |
tree | d2e9163479eb56ec382c842d62ce39fe30d450a4 /test/0-valid.ts | |
download | node-vendor-859a8734c87d5e5081d7b0aa02cb538a7c801eac.tar.gz node-vendor-859a8734c87d5e5081d7b0aa02cb538a7c801eac.tar.bz2 node-vendor-859a8734c87d5e5081d7b0aa02cb538a7c801eac.zip |
Squashed 'fflate/' content from commit b786929
git-subtree-dir: fflate
git-subtree-split: b786929a368521e9cfcdcf7490a8e77485d5a253
Diffstat (limited to 'test/0-valid.ts')
-rw-r--r-- | test/0-valid.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/0-valid.ts b/test/0-valid.ts new file mode 100644 index 0000000..99516b4 --- /dev/null +++ b/test/0-valid.ts @@ -0,0 +1,22 @@ +import { testSuites, workers, bClone } from './util'; +import * as assert from 'uvu/assert'; + +// Name is to ensure that this runs first +// Note that workers are not used here to optimize performance but rather +// to prevent infinite loops from hanging the process. +testSuites({ + async compression(file) { + const fileClone = bClone(file); + const cProm = workers.fflate.deflate(fileClone, [fileClone.buffer]); + cProm.timeout(10000); + const buf = await cProm; + assert.ok(file.equals(await workers.zlib.inflate(buf, [buf.buffer]))); + }, + async decompression(file) { + const fileClone = bClone(file); + const data = await workers.zlib.deflate(fileClone, [fileClone.buffer]); + const dProm = workers.fflate.inflate(data, [data.buffer]); + dProm.timeout(5000); + assert.ok(file.equals(await dProm)); + } +});
\ No newline at end of file |