Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
✅ Added additional unit test for removing keys from proof
Browse files Browse the repository at this point in the history
  • Loading branch information
matjazv committed Sep 12, 2023
1 parent 5489d7b commit 1dae25a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/sparse_merkle_tree.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ describe('SparseMerkleTree', () => {
await expect(smt.removeKeysFromProof(proof, removeKeys)).rejects.toThrow("Invalid input: `Not all sibling hashes were used`");
});

it('should reject by empty queries in proof', async () => {
const smt = new SparseMerkleTree(32);
const proof = {
siblingHashes: [getRandomBytes()],
queries: [],
};
const removeKeys = FixturesInclusionProof.testCases[0].input.queryKeys.map(keyHex => Buffer.from(keyHex, 'hex'));
await expect(smt.removeKeysFromProof(proof, removeKeys)).rejects.toThrow("Invalid input: `Empty`");
});

describe('when there is too many sibling hashes', () => {
for (const test of FixturesInclusionProof.testCases) {
// eslint-disable-next-line no-loop-func
Expand Down

0 comments on commit 1dae25a

Please sign in to comment.