★ 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.
npm run test:contracts # aztec test (TXE)Run the contract's TXE unit tests with `npm run test:contracts`. Walk me through
`packages/contracts/test/src/lib.nr` — especially the test that a second vote from
the same account fails with "duplicate siloed nullifier" — and explain what the TXE
gives you that a full network run does not.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.
npm run test:integration # vitest, in-process network
# or run both tiers:
npm testRun `npm run test:integration` and explain how the in-process network test in
test/integration/voting.test.ts differs from the TXE unit tests — what it exercises
that the TXE cannot (deployment, events, the real send flow).