Integration tests verify that smart contracts interact correctly with the backend API and with each other. These tests ensure end-to-end workflows function properly.
npm run test:integration- Record course progress on-chain
- Retrieve student progress from contract
- Handle concurrent progress updates
- Mint reward tokens on course completion
- Query token balances
- Track mint history
- Issue certificates on course completion
- Verify credentials on-chain
- Store and retrieve credential metadata
- Complete course → trigger token mint
- Handle concurrent contract calls
- Verify state consistency across contracts
tests/integration/
├── contract-integration.test.ts # Analytics & Token contracts
├── credential-integration.test.ts # Credential & Metadata contracts
└── README.md
Integration tests use the full NestJS application context with:
- Real database connections (via testcontainers)
- Contract interaction layer
- Authentication middleware
- Use meaningful test descriptions
- Test both happy path and error scenarios
- Verify transaction hashes are returned
- Check state consistency after operations
- Clean up test data after each test