Clone the repository and install dependencies:
flow deps installRun lint & tests:
make lint
make testcadence/transactions/andcadence/scripts/— production transactions and scripts onlycadence/tests/transactions/andcadence/tests/scripts/— test-only helpers, not for production use
Tests live in cadence/tests/ as *_test.cdc files.
Use the snapshot pattern to reset blockchain state between tests without redeploying contracts:
import Test
import BlockchainHelpers
access(all) var snapshot: UInt64 = 0
access(all) fun beforeEach() {
if snapshot != getCurrentBlockHeight() {
Test.reset(to: snapshot)
}
}
access(all) fun setup() {
// deploy contracts
// setup code every test case needs
snapshot = getCurrentBlockHeight()
}This repo is part of the Flow network, a Layer 1 blockchain built for consumer applications, AI agents, and DeFi at scale.
- Developer docs: https://developers.flow.com
- Cadence language: https://cadence-lang.org
- Community: Flow Discord · Flow Forum
- Governance: Flow Improvement Proposals