Overview
NullGraph uses Anchor’s testing framework with TypeScript and Mocha to verify the full protocol lifecycle. The test suite covers protocol initialization, NKA submission, bounty creation, submission matching, approval, and closure.Running Tests
Local Validator (Recommended)
Run tests against a local Solana validator that starts and stops automatically:- Starts a local Solana validator
- Deploys the program
- Runs all tests in
tests/nullgraph.ts - Stops the validator after completion
The local validator provides a clean, isolated testing environment and is the recommended approach for development.
Existing Devnet Deployment
Run tests against an existing devnet deployment (skips local validator):Test Suite Coverage
The test suite intests/nullgraph.ts covers the complete protocol lifecycle:
Phase 1: Protocol Initialization
- ProtocolState singleton created with correct authority
- Counters initialized at zero
- Fee rate set to 250 basis points (2.5%)
- Treasury address configured
- Duplicate initialization rejected (PDA already exists)
Phase 2: Null Knowledge Asset Submission
- NullResult PDA created with all metadata fields
- Auto-incrementing specimen number (NKA-0001, NKA-0002, etc.)
- Global
nka_counterincrements correctly - Multiple researchers can submit independently
- Data hash stored correctly (SHA-256 fingerprint)
Phase 3: Bounty Marketplace
1
Bounty Creation + Escrow
2
Bounty Submission
3
Invalid Submission Rejection
4
Approval + Payout
5
Bounty Closure + Refund
6
Close Fulfilled Bounty Rejection
Test Coverage Summary
Test Data Setup
The test suite uses mock SPL tokens to simulate BIO token transfers:All token operations use the SPL Token Interface (
@solana/spl-token), ensuring compatibility with any SPL-compliant token including BIO.Running Specific Tests
To run a specific test by name:Test Scripts
The rootpackage.json defines test scripts:
npm test- Run all tests with 1000-second timeoutnpm run lint- Check code formattingnpm run lint:fix- Auto-fix formatting issues
Next Steps
- Deploy your program to devnet
- Explore the program architecture
- Learn about accounts and instructions