Skip to content

Commit a9142cf

Browse files
committed
Fix coverage
1 parent 38255db commit a9142cf

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/lib/bin/secp256k1/secp256k1-wasm.spec.ts

+22
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,28 @@ test('[crypto] getEmbeddedSecp256k1Binary returns the proper binary', async (t)
499499
await streamWasmArrayBuffer(binary)
500500
).arrayBuffer();
501501
t.deepEqual(eventuallyDecompressedBinary, binaryFromDisk);
502+
503+
// compress the wasm binary
504+
const stream = new ReadableStream({
505+
start(controller): void {
506+
controller.enqueue(new Uint8Array(binaryFromDisk));
507+
controller.close();
508+
},
509+
}).pipeThrough(new CompressionStream('gzip'));
510+
511+
const compressedBinary = await new Response(stream).arrayBuffer();
512+
513+
// decompress the compressed wasm binary
514+
const decompressedBinary = await (
515+
await streamWasmArrayBuffer(compressedBinary)
516+
).arrayBuffer();
517+
t.deepEqual(decompressedBinary, binaryFromDisk);
518+
519+
// check that the uncompressed binary produced by `streamWasmArrayBuffer` is the same as the binary from disk
520+
const uncompressedBinary = await (
521+
await streamWasmArrayBuffer(binaryFromDisk)
522+
).arrayBuffer();
523+
t.deepEqual(uncompressedBinary, binaryFromDisk);
502524
});
503525

504526
test('[crypto] Secp256k1Wasm instantiated with embedded binary', async (t) => {

0 commit comments

Comments
 (0)