diff --git a/vite-hardhat/test/index.test.ts b/vite-hardhat/test/index.test.ts index 144f1af..9aefbb7 100644 --- a/vite-hardhat/test/index.test.ts +++ b/vite-hardhat/test/index.test.ts @@ -11,32 +11,35 @@ shelljs.exec('npx hardhat compile'); describe('It compiles noir program code, receiving circuit bytes and abi object.', () => { let noir: Noir; + let backend: BarretenbergBackend; let correctProof: ProofData; beforeEach(async () => { const circuitFile = readFileSync(resolve('artifacts/circuit.json'), 'utf-8'); const circuit = JSON.parse(circuitFile); - const backend = new BarretenbergBackend(circuit); - noir = new Noir(circuit, backend); + backend = new BarretenbergBackend(circuit); + noir = new Noir(circuit); }); it('Should generate valid proof for correct input', async () => { const input = { x: 1, y: 2 }; // Generate proof - correctProof = await noir.generateProof(input); + const { witness } = await noir.execute(input); + correctProof = await backend.generateProof(witness); expect(correctProof.proof instanceof Uint8Array).to.be.true; }); it('Should verify valid proof for correct input', async () => { - const verification = await noir.verifyProof(correctProof); + const verification = await backend.verifyProof(correctProof); expect(verification).to.be.true; }); it('Should fail to generate valid proof for incorrect input', async () => { try { const input = { x: 1, y: 1 }; - const incorrectProof = await noir.generateProof(input); + const { witness } = await noir.execute(input); + const incorrectProof = await backend.generateProof(witness); } catch (err) { // TODO(Ze): Not sure how detailed we want this it to be expect(err instanceof Error).to.be.true;