Skip to content

Commit

Permalink
test(imt.sol): add test for the hash function in the LeanIMT
Browse files Browse the repository at this point in the history
Add a test for the has function in the LeanIMT to check that after deleting a leaf, the has function
returns false for leaf 0.

re privacy-scaling-explorations#228
  • Loading branch information
vplasencia committed Mar 26, 2024
1 parent 35d17f8 commit 4c5ceca
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/imt.sol/test/LeanIMT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,21 @@ describe("LeanIMT", () => {

expect(hasLeaf).to.equal(false)
})

it("Should return false if the leaf is 0", async () => {
await leanIMTTest.insertMany([1, 2])
jsLeanIMT.insertMany([BigInt(1), BigInt(2)])

jsLeanIMT.update(1, BigInt(0))

const { siblings } = jsLeanIMT.generateProof(1)

await leanIMTTest.remove(2, siblings)

const hasLeaf = await leanIMTTest.has(0)

expect(hasLeaf).to.equal(false)
})
})
describe("# indexOf", () => {
it("Should return the index of a leaf", async () => {
Expand Down

0 comments on commit 4c5ceca

Please sign in to comment.