Aztec QuickstartSDK
← Quest map

Test the app

Not required to ship, but worth knowing once the contract compiles: Aztec gives you two tiers of test, and the app uses both. npm test runs them back to back.

TXE unit tests#

The TXE (Test eXecution Environment) runs your contract functions directly — no network, no proving — so the loop is fast. The voting contract's tests live in their own crate at packages/contracts/test/src/lib.nr and cover the pedagogy head-on: a vote bumps the tally, two different accounts both count, end_vote is admin-gated, and — the important one — a second vote from the same account fails on a duplicate nullifier.

bash
npm run test:contracts   # aztec test (TXE)

Integration test#

The integration test drives the real contract through an in-process Aztec network (anvil + L1 contracts + a node, all in one process) — exactly the REGISTER → SIMULATE → SEND flow the frontend runs, but headless and fast. It deploys the contract, casts a private vote, asserts the public tally and the TallyUpdated event, and checks the duplicate-vote rejection end to end.

bash
npm run test:integration   # vitest, in-process network
# or run both tiers:
npm test