2022-10-03 23:23:40 +00:00
|
|
|
import { expect } from "chai";
|
2023-03-29 06:28:09 +00:00
|
|
|
import { ethers, deployments } from "hardhat";
|
2022-10-03 23:23:40 +00:00
|
|
|
|
2023-03-29 06:28:09 +00:00
|
|
|
describe("PoseidonHasher", () => {
|
|
|
|
beforeEach(async () => {
|
|
|
|
await deployments.fixture(["PoseidonHasher"]);
|
|
|
|
});
|
2022-10-03 23:23:40 +00:00
|
|
|
|
2023-03-29 06:28:09 +00:00
|
|
|
it("should hash correctly", async function () {
|
|
|
|
const poseidonHasher = await ethers.getContract("PoseidonHasher");
|
|
|
|
|
|
|
|
// We test hashing for a random number
|
|
|
|
const hash = await poseidonHasher.hash(
|
|
|
|
"19014214495641488759237505126948346942972912379615652741039992445865937985820"
|
|
|
|
);
|
2022-10-03 23:23:40 +00:00
|
|
|
|
2023-03-29 06:28:09 +00:00
|
|
|
expect(hash._hex).to.eql(
|
|
|
|
"0x0c3ac305f6a4fe9bfeb3eba978bc876e2a99208b8b56c80160cfb54ba8f02368"
|
|
|
|
);
|
2022-10-03 23:23:40 +00:00
|
|
|
});
|
|
|
|
});
|