circomlibjs/test/mimc7.js
Micah Zoltu fc0c01e400 Removes many dependencies and bundles to ES Module.
* NodeJS has built-in testing tools now, so no need to include Mocha/Chai which bring in a lot of transitive dependencies.
* Removes ethers, as it was only being used for a few utility functions (which are now in `utils.js` and `keccak256`, whiche is better sourced from @noble/hashes.
* Adds @noble/hashes for `keccak256`.
* Removes hardhat, since it was brought in only to test one thing, and it is huge.
* Switches to esbuild for simple ESM targeted bundling with inlnined NodeJS dependencies.
* Pinned all JS dependencies to fixed versions.
* Adds a Dockerfile for generating reproducible builds.
* Commented out two tests that had a dependency on Hardhat.
2024-12-06 13:17:31 +08:00

22 lines
731 B
JavaScript

import { describe, it, before } from 'node:test'
import assert from 'node:assert'
import buildMimc7 from "../src/mimc7.js";
describe("Mimc7 test", { timeout: 100000 }, function () {
let mimc7;
before(async () => {
mimc7 = await buildMimc7();
});
it("Should check multihash reference 2", async () => {
const res2 = mimc7.multiHash([1,2]);
assert(mimc7.F.eq(mimc7.F.e("0xb91ebbd35d7448ecc13e75a7ceb1ce5bbe428090acfae0da2c3867a874ce6ea"), res2));
});
it("Should check multihash reference 4", async () => {
const res2 = mimc7.multiHash([1,2,3,4]);
assert(mimc7.F.eq(mimc7.F.e("0x19ce9298d9e8ada63b2fb30c938d25cc9116aca2795f8b90fd9530687b4ad075"), res2));
});
});