Skip to content

Commit

Permalink
Fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mainnet-pat committed Sep 6, 2024
1 parent 38255db commit a9142cf
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/lib/bin/secp256k1/secp256k1-wasm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,28 @@ test('[crypto] getEmbeddedSecp256k1Binary returns the proper binary', async (t)
await streamWasmArrayBuffer(binary)
).arrayBuffer();
t.deepEqual(eventuallyDecompressedBinary, binaryFromDisk);

// compress the wasm binary
const stream = new ReadableStream({
start(controller): void {
controller.enqueue(new Uint8Array(binaryFromDisk));
controller.close();
},
}).pipeThrough(new CompressionStream('gzip'));

const compressedBinary = await new Response(stream).arrayBuffer();

// decompress the compressed wasm binary
const decompressedBinary = await (
await streamWasmArrayBuffer(compressedBinary)
).arrayBuffer();
t.deepEqual(decompressedBinary, binaryFromDisk);

// check that the uncompressed binary produced by `streamWasmArrayBuffer` is the same as the binary from disk
const uncompressedBinary = await (
await streamWasmArrayBuffer(binaryFromDisk)
).arrayBuffer();
t.deepEqual(uncompressedBinary, binaryFromDisk);
});

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

0 comments on commit a9142cf

Please sign in to comment.