Testing And Localnet
Test Frontier code in layers. Do not start with a live asset mutation.
Test Layers
Section titled “Test Layers”| Layer | What To Test |
|---|---|
| Unit tests | Pure parsing, validation, graph building and UI formatting. |
| Fixture tests | Known event payloads, static-client rows and API responses. |
| Localnet tests | Move package publish/call flows and object ownership assumptions. |
| Testnet/sandbox tests | Wallet, package and transaction behaviour against public infrastructure. |
| Production smoke tests | Readiness, freshness, one safe read path and one operator-approved write path. |
Move as many failures as possible into unit and fixture tests.
Localnet Use
Section titled “Localnet Use”Localnet is useful for:
- learning Sui CLI basics
- publishing a package repeatedly
- testing Move aborts
- checking transaction construction
- proving a dApp can build the right payload
- running CI-like package tests
Localnet is not proof that the live world package, World API or current static-client data is correct.
Fixture Design
Section titled “Fixture Design”Good fixtures include:
- one valid object/event
- one missing field case
- one wrong environment case
- one stale package id case
- one unresolved display name case
- one duplicate display name with different stable IDs
- one malformed payload
For Registry/API consumers, store only public test data and synthetic data. Do not include private chat, secret routes, tokens or keys.
Contract Tests
Section titled “Contract Tests”For Move extensions, test:
- happy path
- wrong caller
- wrong capability
- wrong item type
- insufficient quantity
- expired permit or claim
- duplicate claim
- missing stock
- config update path
- event output
Make aborts specific enough that the UI can tell users what failed.
dApp Tests
Section titled “dApp Tests”For dApps, test:
- no wallet connected
- wrong network
- locked wallet
- refused signature
- stale object version
- transaction failure after signing
- sponsor unavailable
- unresolved Registry label
- API degraded or not ready
- missing World API field
Do not make a dApp require the public API for every render if only a small label failed to load.
Route And Graph Tests
Section titled “Route And Graph Tests”For route planners:
- test disconnected systems
- test self-loops
- test duplicate edges
- test directed and undirected assumptions
- test missing coordinates
- test avoided systems
- test weighted route changes
- test source/freshness display
Route logic should be local and deterministic. Registry/API data should feed the graph, not own the algorithm.
Release Checklist
Section titled “Release Checklist”Before release:
- run local tests
- run contract tests
- build the frontend
- verify CSP/security headers if web-hosted
- verify API default environment and cycle
- verify no private keys or tokens are in artefacts
- verify the dApp handles refused signatures
- verify a user can copy object IDs and transaction digests
- verify public data freshness is visible
Ship only after the tool fails safely in the cases you expect to happen.