mirror of
https://github.com/arnaucube/miksi-core.git
synced 2026-02-06 19:16:40 +01:00
Move tests to root dir
This commit is contained in:
36
test/withdraw.test.ts
Normal file
36
test/withdraw.test.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
const path = require("path");
|
||||
const tester = require("circom").tester;
|
||||
const chai = require("chai");
|
||||
const assert = chai.assert;
|
||||
const circomlib = require("circomlib");
|
||||
|
||||
export {};
|
||||
|
||||
describe("withdraw test", function () {
|
||||
this.timeout(200000);
|
||||
|
||||
|
||||
it("Test Withdraw", async () => {
|
||||
const circuit = await tester(
|
||||
path.join(__dirname, "../circuits/circuits", "withdraw.circom"),
|
||||
{reduceConstraints: false}
|
||||
);
|
||||
|
||||
// const secret = Math.floor(Math.random()*1000).toString();
|
||||
const secret = "123456789";
|
||||
|
||||
const coinCode = "1";
|
||||
const amount = "100";
|
||||
|
||||
const poseidon = circomlib.poseidon.createHash(6, 8, 57);
|
||||
const commitment = poseidon([coinCode, amount, secret]).toString();
|
||||
|
||||
const witness = await circuit.calculateWitness({
|
||||
"coinCode": coinCode,
|
||||
"amount": amount,
|
||||
"commitment": commitment,
|
||||
"secret": secret
|
||||
});
|
||||
await circuit.checkConstraints(witness);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user